Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -65,17 +65,28 @@ async def respond(message, history, system_message, max_tokens, temperature, top
|
|
65 |
except Exception as e:
|
66 |
yield f"Error: {str(e)}"
|
67 |
|
68 |
-
# ------ Gradio Interface with Example Query ------
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
if __name__ == "__main__":
|
81 |
demo.launch()
|
|
|
65 |
except Exception as e:
|
66 |
yield f"Error: {str(e)}"
|
67 |
|
68 |
+
# ------ Gradio Interface with Example Query Button ------
|
69 |
+
with gr.Blocks() as demo:
|
70 |
+
with gr.Row():
|
71 |
+
chatbot = gr.ChatInterface(
|
72 |
+
respond,
|
73 |
+
additional_inputs=[
|
74 |
+
gr.Textbox(value="Medical diagnosis assistant", label="System Role"),
|
75 |
+
gr.Slider(512, 2048, value=512, step=128, label="Max Tokens"),
|
76 |
+
gr.Slider(0.1, 2.0, value=0.7, step=0.1, label="Temperature"),
|
77 |
+
gr.Slider(0.5, 1.0, value=0.95, step=0.05, label="Top-p")
|
78 |
+
]
|
79 |
+
)
|
80 |
+
with gr.Row():
|
81 |
+
example_button = gr.Button("Use Example Query")
|
82 |
+
example_query = gr.Textbox(
|
83 |
+
value="I have a headache and fever",
|
84 |
+
label="Example Query",
|
85 |
+
interactive=False
|
86 |
+
)
|
87 |
+
|
88 |
+
# Trigger example query manually when button is clicked
|
89 |
+
example_button.click(fn=lambda: "I have a headache and fever", outputs=[chatbot])
|
90 |
|
91 |
if __name__ == "__main__":
|
92 |
demo.launch()
|