joseph / app.py
joseph7251's picture
Update app.py
84ca1fb verified
raw
history blame
453 Bytes
import gradio as gr
def draw_number(max_number):
"""
抽取一個隨機號碼
Args:
max_number: 班級座號的最大值
Returns:
抽出的隨機號碼
"""
import random
return random.randint(1, max_number)
# 建立使用者介面
demo = gr.Interface(
fn=draw_number,
inputs="number",
outputs="text",
title="隨機抽號",
description="輸入班級座號的最大值,點擊抽籤"
)
# 啟動伺服器
demo.launch()