Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,25 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
# 創建 Gradio 介面
|
7 |
interface = gr.Interface(
|
8 |
-
fn=
|
9 |
-
inputs="
|
10 |
outputs="text",
|
11 |
-
title="
|
12 |
-
description="
|
13 |
)
|
14 |
|
15 |
# 啟動 Gradio 應用
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
# 猜測晚餐的提示內容
|
4 |
+
def guess_dinner(hint):
|
5 |
+
dinner_options = {
|
6 |
+
"It is cheesy and often served in slices.": "Pizza",
|
7 |
+
"It is a type of pasta usually served with a creamy sauce.": "Spaghetti",
|
8 |
+
"It is grilled, and some people like to add barbecue sauce.": "Grilled Chicken",
|
9 |
+
"It is usually found in a bun with lettuce and tomato.": "Hamburger",
|
10 |
+
"It is a popular dish in Asia, often served with soy sauce.": "Sushi"
|
11 |
+
}
|
12 |
+
|
13 |
+
# 根據提示猜測晚餐
|
14 |
+
return dinner_options.get(hint, "I don't know, please give me a valid hint!")
|
15 |
|
16 |
# 創建 Gradio 介面
|
17 |
interface = gr.Interface(
|
18 |
+
fn=guess_dinner,
|
19 |
+
inputs=gr.Textbox(lines=2, placeholder="輸入提示內容來猜猜我的晚餐..."),
|
20 |
outputs="text",
|
21 |
+
title="最強第一組",
|
22 |
+
description="給我提示內容,讓我猜猜你的晚餐!"
|
23 |
)
|
24 |
|
25 |
# 啟動 Gradio 應用
|