joseph7251 commited on
Commit
84ca1fb
·
verified ·
1 Parent(s): daed61e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py CHANGED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def draw_number(max_number):
4
+ """
5
+ 抽取一個隨機號碼
6
+
7
+ Args:
8
+ max_number: 班級座號的最大值
9
+
10
+ Returns:
11
+ 抽出的隨機號碼
12
+ """
13
+ import random
14
+ return random.randint(1, max_number)
15
+
16
+ # 建立使用者介面
17
+ demo = gr.Interface(
18
+ fn=draw_number,
19
+ inputs="number",
20
+ outputs="text",
21
+ title="隨機抽號",
22
+ description="輸入班級座號的最大值,點擊抽籤"
23
+ )
24
+
25
+ # 啟動伺服器
26
+ demo.launch()