Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -57,6 +57,7 @@ class MultiModalModel(nn.Module):
|
|
| 57 |
do_sample=True
|
| 58 |
)
|
| 59 |
return self.code_tokenizer.decode(outputs[0], skip_special_tokens=True)
|
|
|
|
| 60 |
|
| 61 |
# 定义 Gradio 接口的推理函数
|
| 62 |
def gradio_inference(task, input_text):
|
|
@@ -79,7 +80,7 @@ model = MultiModalModel()
|
|
| 79 |
# 创建 Gradio 接口
|
| 80 |
interface = gr.Interface(
|
| 81 |
fn=gradio_inference,
|
| 82 |
-
inputs=[gr.
|
| 83 |
outputs="text",
|
| 84 |
title="多模态模型推理",
|
| 85 |
description="选择任务类型并输入文本以进行推理"
|
|
|
|
| 57 |
do_sample=True
|
| 58 |
)
|
| 59 |
return self.code_tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 60 |
+
# 添加其他任务的逻辑...
|
| 61 |
|
| 62 |
# 定义 Gradio 接口的推理函数
|
| 63 |
def gradio_inference(task, input_text):
|
|
|
|
| 80 |
# 创建 Gradio 接口
|
| 81 |
interface = gr.Interface(
|
| 82 |
fn=gradio_inference,
|
| 83 |
+
inputs=[gr.Dropdown(choices=["text_generation", "code_generation"], label="任务类型"), gr.Textbox(lines=2, placeholder="输入文本...")],
|
| 84 |
outputs="text",
|
| 85 |
title="多模态模型推理",
|
| 86 |
description="选择任务类型并输入文本以进行推理"
|