Update app.py
Browse files
app.py
CHANGED
|
@@ -63,19 +63,30 @@ def chat_with_model(user_input, model_choice):
|
|
| 63 |
# Gradio UI
|
| 64 |
with gr.Blocks(title="Phi-3 Instruct Explorer") as demo:
|
| 65 |
gr.Markdown("## 🧠 Phi-3 Instruct Explorer\nSwitch between Phi-3 instruct models and test responses on CPU.")
|
|
|
|
| 66 |
with gr.Row():
|
| 67 |
-
gr.
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
|
|
|
| 72 |
with gr.Row():
|
| 73 |
user_input = gr.Textbox(label="Your message", placeholder="Ask me anything...")
|
|
|
|
| 74 |
with gr.Row():
|
| 75 |
output = gr.Textbox(label="Model response")
|
|
|
|
| 76 |
with gr.Row():
|
| 77 |
submit = gr.Button("Generate")
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
submit.click(fn=chat_with_model, inputs=[user_input, model_choice], outputs=output)
|
| 80 |
|
| 81 |
demo.launch()
|
|
|
|
| 63 |
# Gradio UI
|
| 64 |
with gr.Blocks(title="Phi-3 Instruct Explorer") as demo:
|
| 65 |
gr.Markdown("## 🧠 Phi-3 Instruct Explorer\nSwitch between Phi-3 instruct models and test responses on CPU.")
|
| 66 |
+
|
| 67 |
with gr.Row():
|
| 68 |
+
model_choice = gr.Dropdown(
|
| 69 |
+
label="Choose a model",
|
| 70 |
+
choices=list(MODEL_OPTIONS.keys()),
|
| 71 |
+
value="Phi-3.5 Mini Instruct"
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
with gr.Row():
|
| 75 |
user_input = gr.Textbox(label="Your message", placeholder="Ask me anything...")
|
| 76 |
+
|
| 77 |
with gr.Row():
|
| 78 |
output = gr.Textbox(label="Model response")
|
| 79 |
+
|
| 80 |
with gr.Row():
|
| 81 |
submit = gr.Button("Generate")
|
| 82 |
|
| 83 |
+
# Example prompts
|
| 84 |
+
gr.Markdown("### 🧪 Try an example prompt:")
|
| 85 |
+
gr.Examples(
|
| 86 |
+
examples=EXAMPLES,
|
| 87 |
+
inputs=user_input
|
| 88 |
+
)
|
| 89 |
+
|
| 90 |
submit.click(fn=chat_with_model, inputs=[user_input, model_choice], outputs=output)
|
| 91 |
|
| 92 |
demo.launch()
|