chuho commited on
Commit
bd3d119
·
verified ·
1 Parent(s): 97c97c8
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ # 定義一個簡單的處理函數
4
+ def say_hello(name):
5
+ if not name:
6
+ name = "世界"
7
+ return f"你好,{name}!這是我成功運行的第一個 Hugging Face Space!"
8
+
9
+ # 建立 Gradio 互動介面
10
+ demo = gr.Interface(
11
+ fn=say_hello,
12
+ inputs=gr.Textbox(lines=1, placeholder="請輸入你的名字..."),
13
+ outputs="text",
14
+ title="你好世界 (Hello World)",
15
+ description="輸入你的名字,看看會發生什麼事!"
16
+ )
17
+
18
+ # 啟動應用程式
19
+ if __name__ == "__main__":
20
+ demo.launch()