PDAson's picture
Upload test.py
f5054aa verified
raw
history blame contribute delete
522 Bytes
import gradio as gr
# 定义简单的模型函数
def image_classifier(image, username):
return {'cat': 0.3, 'dog': 0.7}
# 使用 SimpleCSVLogger 并支持用户名存储
flagging_callback = gr.SimpleCSVLogger()
# 创建 Gradio 接口,增加 username 的输入支持
demo = gr.Interface(
fn=image_classifier,
inputs=["image", "text"], # 输入包括图像和用户名
outputs="label",
flagging_callback=flagging_callback # 启用标记功能
)
# 启动界面
demo.launch()