Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from transformers import pipeline | |
| # 加载你的模型 | |
| model = pipeline("text-generation", model="Jackrong/Qwen3.5-27B-Claude-4.6-Opus-Reasoning-Distilled") # 替换为你的模型 | |
| def generate_text(prompt): | |
| result = model(prompt, max_length=100, do_sample=True) | |
| return result[0]['generated_text'] | |
| # 创建Gradio界面 | |
| iface = gr.Interface( | |
| fn=generate_text, | |
| inputs=gr.Textbox(label="输入文本"), | |
| outputs=gr.Textbox(label="生成结果"), | |
| title="我的AI模型API", | |
| description="这是一个可以通过API调用的AI模型" | |
| ) | |
| # 启动Gradio应用 | |
| iface.launch() |