Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -100,8 +100,8 @@ def build_interface():
|
|
| 100 |
grouped = fetch_models_grouped()
|
| 101 |
default_model = grouped["reasoning"][0] if grouped["reasoning"] else ""
|
| 102 |
|
| 103 |
-
with gr.Blocks(title="
|
| 104 |
-
gr.Markdown("## 🤖
|
| 105 |
|
| 106 |
saved_chats = gr.State({})
|
| 107 |
current_name = gr.State("Chat #1")
|
|
@@ -125,6 +125,7 @@ def build_interface():
|
|
| 125 |
)
|
| 126 |
output = gr.Textbox(label="Conversazione", lines=20, interactive=False)
|
| 127 |
prompt = gr.Textbox(label="Prompt", lines=3, placeholder="Scrivi qui...")
|
|
|
|
| 128 |
|
| 129 |
# --- wiring -------------------------------------------------
|
| 130 |
def resolve(prompt, r, c, hist):
|
|
@@ -143,6 +144,13 @@ def build_interface():
|
|
| 143 |
def load_fn(chats, sel):
|
| 144 |
return (chats[sel], format_history(chats[sel]), sel) if sel in chats else ([], "", "⚠️ Seleziona chat")
|
| 145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
prompt.submit(
|
| 147 |
fn=resolve,
|
| 148 |
inputs=[prompt, reasoning_dd, casual_dd, history],
|
|
|
|
| 100 |
grouped = fetch_models_grouped()
|
| 101 |
default_model = grouped["reasoning"][0] if grouped["reasoning"] else ""
|
| 102 |
|
| 103 |
+
with gr.Blocks(title="OpenRouter Chat – HF Space") as demo:
|
| 104 |
+
gr.Markdown("## 🤖 OpenRouter Chatbot (HF Space edition)")
|
| 105 |
|
| 106 |
saved_chats = gr.State({})
|
| 107 |
current_name = gr.State("Chat #1")
|
|
|
|
| 125 |
)
|
| 126 |
output = gr.Textbox(label="Conversazione", lines=20, interactive=False)
|
| 127 |
prompt = gr.Textbox(label="Prompt", lines=3, placeholder="Scrivi qui...")
|
| 128 |
+
send_btn = gr.Button("📤 Invia") # <--- ADDED
|
| 129 |
|
| 130 |
# --- wiring -------------------------------------------------
|
| 131 |
def resolve(prompt, r, c, hist):
|
|
|
|
| 144 |
def load_fn(chats, sel):
|
| 145 |
return (chats[sel], format_history(chats[sel]), sel) if sel in chats else ([], "", "⚠️ Seleziona chat")
|
| 146 |
|
| 147 |
+
# Gradio events
|
| 148 |
+
send_btn.click( # <--- NEW EVENT
|
| 149 |
+
fn=resolve,
|
| 150 |
+
inputs=[prompt, reasoning_dd, casual_dd, history],
|
| 151 |
+
outputs=[history, output],
|
| 152 |
+
queue=False,
|
| 153 |
+
)
|
| 154 |
prompt.submit(
|
| 155 |
fn=resolve,
|
| 156 |
inputs=[prompt, reasoning_dd, casual_dd, history],
|