Spaces:
Paused
Paused
Revert to old Gradio format for HF Spaces compatibility
Browse files- Removed type="messages" parameter (not supported in HF Gradio)
- Use list of [user, bot] pairs instead of dict format
- Fixes: TypeError: Chatbot.__init__() got an unexpected keyword argument 'type'
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
app.py
CHANGED
|
@@ -170,7 +170,7 @@ def chat(message, history):
|
|
| 170 |
with gr.Blocks() as demo:
|
| 171 |
gr.Markdown(f"# MedRAX2 - Medical AI Assistant\n**Device:** {device} | **Tools:** {len(tools)} loaded | **Orchestrator:** Gemini 2.0 Flash")
|
| 172 |
|
| 173 |
-
chatbot = gr.Chatbot(
|
| 174 |
viz_output = gr.Image(label="Grounding Visualization", visible=True)
|
| 175 |
|
| 176 |
msg = gr.MultimodalTextbox(
|
|
@@ -189,19 +189,11 @@ with gr.Blocks() as demo:
|
|
| 189 |
else:
|
| 190 |
text = message
|
| 191 |
|
| 192 |
-
# Add to chat history - use
|
| 193 |
if chat_history is None:
|
| 194 |
chat_history = []
|
| 195 |
|
| 196 |
-
|
| 197 |
-
if len(chat_history) > 0 and isinstance(chat_history[0], dict):
|
| 198 |
-
# Messages format
|
| 199 |
-
chat_history.append({"role": "user", "content": text})
|
| 200 |
-
chat_history.append({"role": "assistant", "content": bot_message})
|
| 201 |
-
else:
|
| 202 |
-
# Try messages format first (for newer Gradio)
|
| 203 |
-
chat_history.append({"role": "user", "content": text})
|
| 204 |
-
chat_history.append({"role": "assistant", "content": bot_message})
|
| 205 |
|
| 206 |
return "", chat_history, viz_image
|
| 207 |
|
|
|
|
| 170 |
with gr.Blocks() as demo:
|
| 171 |
gr.Markdown(f"# MedRAX2 - Medical AI Assistant\n**Device:** {device} | **Tools:** {len(tools)} loaded | **Orchestrator:** Gemini 2.0 Flash")
|
| 172 |
|
| 173 |
+
chatbot = gr.Chatbot()
|
| 174 |
viz_output = gr.Image(label="Grounding Visualization", visible=True)
|
| 175 |
|
| 176 |
msg = gr.MultimodalTextbox(
|
|
|
|
| 189 |
else:
|
| 190 |
text = message
|
| 191 |
|
| 192 |
+
# Add to chat history - use list of pairs format for older Gradio
|
| 193 |
if chat_history is None:
|
| 194 |
chat_history = []
|
| 195 |
|
| 196 |
+
chat_history.append([text, bot_message])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
|
| 198 |
return "", chat_history, viz_image
|
| 199 |
|