Update app.py
Browse files
app.py
CHANGED
|
@@ -13,6 +13,14 @@ MODEL_OPTIONS = {
|
|
| 13 |
# Cache for loaded models
|
| 14 |
loaded_models = {}
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
# Load model/tokenizer on demand
|
| 17 |
def load_model(model_id):
|
| 18 |
if model_id not in loaded_models:
|
|
@@ -55,6 +63,10 @@ def chat_with_model(user_input, model_choice):
|
|
| 55 |
# Gradio UI
|
| 56 |
with gr.Blocks(title="Phi-3 Instruct Explorer") as demo:
|
| 57 |
gr.Markdown("## 🧠 Phi-3 Instruct Explorer\nSwitch between Phi-3 instruct models and test responses on CPU.")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
with gr.Row():
|
| 59 |
model_choice = gr.Dropdown(label="Choose a model", choices=list(MODEL_OPTIONS.keys()), value="Phi-3.5 Mini Instruct")
|
| 60 |
with gr.Row():
|
|
|
|
| 13 |
# Cache for loaded models
|
| 14 |
loaded_models = {}
|
| 15 |
|
| 16 |
+
EXAMPLES = [
|
| 17 |
+
"Write a short story about a robot who learns to paint.",
|
| 18 |
+
"Summarize this paragraph: The Basque coast is known for its rugged cliffs, rich maritime history, and vibrant local culture.",
|
| 19 |
+
"Explain how solar panels work in simple terms.",
|
| 20 |
+
"Translate this sentence into Basque: 'The sea is calm today.'",
|
| 21 |
+
"Write a noir-style intro for a detective in Gros."
|
| 22 |
+
]
|
| 23 |
+
|
| 24 |
# Load model/tokenizer on demand
|
| 25 |
def load_model(model_id):
|
| 26 |
if model_id not in loaded_models:
|
|
|
|
| 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.Markdown("### 🧪 Try an example prompt:")
|
| 68 |
+
with gr.Row():
|
| 69 |
+
examples = gr.Dataset(components=[user_input], samples=[[e] for e in EXAMPLES])
|
| 70 |
with gr.Row():
|
| 71 |
model_choice = gr.Dropdown(label="Choose a model", choices=list(MODEL_OPTIONS.keys()), value="Phi-3.5 Mini Instruct")
|
| 72 |
with gr.Row():
|