智慧咖啡廳設計提案
"team 4":[
{"leader":"徐子越",
"mem1":"毛鼎言",
"mem2":"劉安昇",
"mem3":"許哲偉",
"mem4":"劉安華",
"mem5":"陳惠龍"}
]
設計理念
Concepts
目的
期望能利用人工智慧的各項技術,搭配上互動式的空間設計,帶給顧客有別於現有餐廳的使用者體驗。
管理人員能用更有效率的方式管控原物料的庫存,並透過演算法來預測原物料的價格,藉此控制成本。
Concepts
設計特色
& 進度規劃
Features
Features
動機
Features
實作步驟
Features
爬蟲過程
Features
機器學習模型(貝氏分類器)
'use strict';
const
bodyParser = require('body-parser'),
config = require('config'),
express = require('express'),
request = require('request');
var app = express();
var port = process.env.PORT || process.env.port || 5000;
app.set('port',port);
app.use(bodyParser.json());
app.use(express.static('public'));
const SHEETDB_PRODUCTINFO_ID = config.get('productinfo_id');
// 主程式運作邏輯
app.post('/webhook',function(req,res){
console.log("[WebHook] In");
let data = req.body;
let queryCategory = data.queryResult.parameters["Category"];
var thisQs={};
if(queryCategory=="熱門")
{
thisQs.IsHot = "True";
}else
{
thisQs.Category = queryCategory;
}
thisQs.casesensitive = false;
request({
// uri:"https://sheetdb.io/api/v1/"+SHEETDB_PRODUCTINFO_ID,
uri:"http://54.255.249.25/api/product/",
json:true,
// method:"PUT",
method:"GET",
headers:{"Content-Type":"application/json"},
// qs:thisQs
body:{"data":[thisQs]}
// body:{"categoryname":lightStatus}
},function(error,response,body) {
if(!error && response.statusCode == 200){
console.log(response.statusCode);
console.log("[SheetDB API] Success");
sendCards(body, res);
}else{
console.log(response.statusCode);
console.log("[SheetDB API] failed");
}
});
});
app.listen(app.get('port'),function(){
console.log("[app.listen] Node app is running on port", app.get('port'));
});
module.exports = app;
function sendCards(body,res){
console.log("[sendCarsoulCards] In");
var thisFulfillmentMessages = [];
for(var x=0; x<body.length; x++)
{
var thisObject={};
thisObject.card={};
thisObject.card.title=body[x].modelname;
thisObject.card.subtitle=body[x].modelnumber;
thisObject.card.imageUri=body[x].productimage;
thisObject.card.buttons=[
{
"text":"看大圖",
"postback":body[x].productimage,
}
];
thisFulfillmentMessages.push(thisObject);
console.log(thisObject)
var responseObject={
fulfillmentMessages : thisFulfillmentMessages
}
}
res.json(responseObject);
}
Features
測試結果
Features
代辦事項
Features
概念
預約流程
從資料庫get預約狀況資料,傳送給bot讓使用者看到。
->輸入完各項資料後post回資料庫
->查詢預約紀錄、取消預約以及再次預約其他日子
Features
Features
預約流程圖
Features
var restify = require('restify');
var builder = require('botbuilder');
var menu = require('./menuConfig.json')
//create web server
var server = restify.createServer();
server.listen(process.env.port||process.env.port||"3978",function(){
console.log('$s listening to %s', server.name, server.url);
});
//create chat connector for communicating with the Bot Framework Service
var connector = new builder.ChatConnector({
appId: process.env.MicrosoftAppId,
appPassword: process.env.MicrosoftAppPassword
});
//listen for messages from users
server.post('/api/messages', connector.listen());
var bot = new builder.UniversalBot(connector, [
//default dialog
function(session){
session.send("歡迎來到趣味小試題");
session.beginDialog('booking');
},
// function(session, results){
// session.dialogData.orders = results.response;
// session.beginDialog('customer info');
// },
function(session, results){
// var customer = session.dialogData.customer = results.response;
var orders = session.dialogData.orders = results.response;
// var checkinTaipeiZone = session.dialogData.orders.checkin.toLocaleString('en-us', {
// timeZone: 'Asia/Taipei'
// });
// var checkoutTaipeiZone = session.dialogData.orders.checkout.toLocaleString('en-us', {
// timeZone: 'Asia/Taipei'
// });
session.endDialog(
`
您的大名:${orders.name}<br />
您的成績:<br />
第一題答案:HTML,你的回答是:${orders.question1}<br />
第二題答案:${orders.question2}<br />
第三題答案:${orders.question3}<br />
第四題答案:${orders.question4}<br />
第五題答案:${orders.question5}<br />
第六題答案:${orders.question6}<br />`
);
},
]);
bot.dialog('booking', [
function(session){
session.dialogData.orders = {}; //給一個初始化的值
// builder.Prompts.time(session, "請問您的入住時間? (例如: 明天下午5點)");
// },
// function(session, results){
// session.dialogData.orders.checkin = builder.EntityRecognizer.resolveTime([results.response]);
// builder.Prompts.time(session, "請問您的退房時間? (例如: 後天早上11點)");
// },
// function(session, results){
// session.dialogData.orders.checkout = builder.EntityRecognizer.resolveTime([results.response]);
// session.endDialog(`退房時間:${dateTaipeiZone}`);
builder.Prompts.text(session, "大大的名字?");
},
function(session, results){
session.dialogData.orders.name = results.response;
builder.Prompts.choice(session, "以下哪個是屬於前端的技術?", "HTML|Python|MySQL|Web Crawler(網路爬蟲)",{listStyle: builder.ListStyle.button});
},
function(session, results){
session.dialogData.orders.question1 = results.response.entity;
if(session.dialogData.orders.question1 == "HTML"){
session.send("答對囉!")
}else{
session.send("答錯囉! 答案是 HTML 才對")
}
builder.Prompts.choice(session, "想要顯示出'Hello World'的正確JavaScripts的語法是?", "print('Hello World')|response.write('Hello World')|document.write('Hello World')|對不起,這題我不會",{listStyle: builder.ListStyle.button});
},
function(session, results){
session.dialogData.orders.question2 = results.response.entity;
if(session.dialogData.orders.question2 == "document.write('Hello World')"){
session.send("答對囉!")
}else if(session.dialogData.orders.question2 == "對不起,這題我不會"){
session.send("沒關係! 不過答案是 document.write('Hello World') 才對喔")
}
else{
session.send("答錯囉! 答案是 document.write('Hello World') 才對")
}
builder.Prompts.choice(session, "下面哪個是HTML5中出現的新出現的網頁元素?", "<hr>|<fieldset>|<pre>|<nav>",{listStyle: builder.ListStyle.button});
},
function(session, results){
session.dialogData.orders.question3 = results.response.entity;
if(session.dialogData.orders.question3 == "<nav>"){
session.send("答對囉!")
}else{
session.send("答錯囉! 答案是 <nav> 才對")
}
builder.Prompts.choice(session, "以下哪個平台'不是'使用webhook跟Dialogflow串連的?", "Facebook Messenger|LINE|Amazon Alexa|Microsoft Cortana",{listStyle: builder.ListStyle.button});
},
function(session, results){
session.dialogData.orders.question4 = results.response.entity;
if(session.dialogData.orders.question4 == "Amazon Alexa"){
session.send("答對囉!")
}else{
session.send("答錯囉! 答案是 Amazon Alexa 才對,因為Alexa是用import的方式跟Dialogflow串連的!")
}
builder.Prompts.choice(session, "請問以下幾位誰最帥?", "金城武|林俊傑|周杰倫|徐子越",{listStyle: builder.ListStyle.button});
},
function(session, results){
session.dialogData.orders.question5 = results.response.entity;
if(session.dialogData.orders.question5 == "徐子越"){
session.send("答對囉!你真有眼光!")
}else{
session.send("答錯囉! 答案是 徐子越 才對喔!")
}
builder.Prompts.choice(session, "你覺得這份測驗:", "太簡單,浪費我的時間|有點簡單,可以再難一點|難度適中,有些選項不太確定|太難啦,都忘光光啦",{listStyle: builder.ListStyle.button});
},
function(session, results){
session.dialogData.orders.question6 = results.response.entity;
session.endDialogWithResult({
response: session.dialogData.orders
});
},
]);
Bot Framework 平台
Features
Bot Framework 平台
Features
'use strict';
const
bodyParser = require('body-parser'),
config = require('config'),
express = require('express'),
request = require('request');
var app = express();
var port = process.env.PORT || process.env.port || 5000;
app.set('port',port);
app.use(bodyParser.json());
app.use(express.static('public'));
const SHEETDB_PRODUCTINFO_ID = config.get('productinfo_id');
// 主程式運作邏輯
app.post('/webhook',function(req,res){
console.log("[WebHook] In");
let data = req.body;
let queryCategory = data.queryResult.parameters["Category"];
var thisQs={};
if(queryCategory=="熱門")
{
thisQs.IsHot = "True";
}else
{
thisQs.Category = queryCategory;
}
thisQs.casesensitive = false;
request({
// uri:"https://sheetdb.io/api/v1/"+SHEETDB_PRODUCTINFO_ID,
uri:"http://54.255.249.25/api/product/",
json:true,
// method:"PUT",
method:"GET",
headers:{"Content-Type":"application/json"},
// qs:thisQs
body:{"data":[thisQs]}
// body:{"categoryname":lightStatus}
},function(error,response,body) {
if(!error && response.statusCode == 200){
console.log(response.statusCode);
console.log("[SheetDB API] Success");
sendCards(body, res);
}else{
console.log(response.statusCode);
console.log("[SheetDB API] failed");
}
});
});
app.listen(app.get('port'),function(){
console.log("[app.listen] Node app is running on port", app.get('port'));
});
module.exports = app;
function sendCards(body,res){
console.log("[sendCarsoulCards] In");
var thisFulfillmentMessages = [];
for(var x=0; x<body.length; x++)
{
var thisObject={};
thisObject.card={};
thisObject.card.title=body[x].modelname;
thisObject.card.subtitle=body[x].modelnumber;
thisObject.card.imageUri=body[x].productimage;
thisObject.card.buttons=[
{
"text":"看大圖",
"postback":body[x].productimage,
}
];
thisFulfillmentMessages.push(thisObject);
console.log(thisObject)
var responseObject={
fulfillmentMessages : thisFulfillmentMessages
}
}
res.json(responseObject);
}
Dialogflow + RestAPI
Features
Dialogflow + RestAPI
概念
Features
概念
Features
概念圖
Features
Features
Features
服務
目的
Features
自走車組裝及安裝ubuntu在RPiG上
->跑道設計、影像校正
->道路辨識學習
->道路辨識與影像辨識整合
->道路辨識與影像辨識整合debug
(提升道路及影像識別率)
進度流程表
Features
小鴨車的組裝以及在Rpi上安裝ubuntu,並解決樹莓派安裝ubuntu mate的bugs,接下來調校鏡頭及跑道設計。
目前進度
Features
目前進度
Features
Features
服務
目的
目的
Features
技術
困難
Features
系統架構與流程
Features
物體辨識實作
Features
利用webcam監視庫存區,使用物件辨識定時檢查庫存量,並記錄於資料庫。
庫存管理
衛生管理
同時也兼負著衛生管理的功能,如拍攝到有蟑螂老鼠進入庫存區,會自動拍攝照片並傳給店家。
Features
目前進度
VMware+Ubuntu+Node.js+Python+Opencv
平台串聯測試
Features
咖啡價格序列、氣象、股市...等資料前處理
-> 咖啡豆價格ML預測
-> 咖啡豆價格DL預測
進度規劃
請不吝指教,謝謝!
by-Team 4