VeryOnly123 commited on
Commit
980ae49
·
verified ·
1 Parent(s): db04ca0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -4
app.py CHANGED
@@ -1,7 +1,21 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ # 加载你的模型
5
+ model = pipeline("text-generation", model="Jackrong/Qwen3.5-27B-Claude-4.6-Opus-Reasoning-Distilled") # 替换为你的模型
6
 
7
+ def generate_text(prompt):
8
+ result = model(prompt, max_length=100, do_sample=True)
9
+ return result[0]['generated_text']
10
+
11
+ # 创建Gradio界面
12
+ iface = gr.Interface(
13
+ fn=generate_text,
14
+ inputs=gr.Textbox(label="输入文本"),
15
+ outputs=gr.Textbox(label="生成结果"),
16
+ title="我的AI模型API",
17
+ description="这是一个可以通过API调用的AI模型"
18
+ )
19
+
20
+ # 启动Gradio应用
21
+ iface.launch()