Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -48,17 +48,17 @@ def infer(message: str, sysprompt: str, tokens: int=30):
|
|
48 |
return output_md, info_md
|
49 |
|
50 |
with gr.Blocks() as demo:
|
|
|
51 |
with gr.Row():
|
52 |
message = gr.Textbox(label="Message", value="", lines=1)
|
53 |
sysprompt = gr.Textbox(label="System prompt", value="You are Qwen, created by Alibaba Cloud. You are a helpful assistant.", lines=4)
|
54 |
tokens = gr.Slider(label="Max tokens", value=30, minimum=1, maximum=2048, step=1)
|
55 |
-
model_name = gr.Dropdown(label="Model", choices=MODELS, value=MODELS[0], allow_custom_value=True)
|
56 |
-
#image_url = gr.Textbox(label="Image URL", value=url, lines=1)
|
57 |
run_button = gr.Button("Run", variant="primary")
|
58 |
output_md = gr.Markdown("<br><br>")
|
59 |
info_md = gr.Markdown("<br><br>")
|
60 |
|
61 |
-
run_button.click
|
|
|
62 |
model_name.change(load_model, [model_name], [model_name])
|
63 |
|
64 |
demo.launch()
|
|
|
48 |
return output_md, info_md
|
49 |
|
50 |
with gr.Blocks() as demo:
|
51 |
+
model_name = gr.Dropdown(label="Model", choices=MODELS, value=MODELS[0], allow_custom_value=True)
|
52 |
with gr.Row():
|
53 |
message = gr.Textbox(label="Message", value="", lines=1)
|
54 |
sysprompt = gr.Textbox(label="System prompt", value="You are Qwen, created by Alibaba Cloud. You are a helpful assistant.", lines=4)
|
55 |
tokens = gr.Slider(label="Max tokens", value=30, minimum=1, maximum=2048, step=1)
|
|
|
|
|
56 |
run_button = gr.Button("Run", variant="primary")
|
57 |
output_md = gr.Markdown("<br><br>")
|
58 |
info_md = gr.Markdown("<br><br>")
|
59 |
|
60 |
+
gr.on(triggers=[run_button.click, message.submit], fn=infer, inputs=[message, sysprompt, tokens], outputs=[output_md, info_md])
|
61 |
+
#run_button.click(infer, [message, sysprompt, tokens], [output_md, info_md])
|
62 |
model_name.change(load_model, [model_name], [model_name])
|
63 |
|
64 |
demo.launch()
|