Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,26 +3,35 @@ import os
|
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
# ---------------------------------------------------
|
| 6 |
-
# 🔧 Patch 1: Blocks ignores
|
| 7 |
# ---------------------------------------------------
|
| 8 |
_old_blocks = gr.Blocks
|
| 9 |
|
| 10 |
def PatchedBlocks(*args, **kwargs):
|
| 11 |
-
|
| 12 |
-
|
|
|
|
| 13 |
return _old_blocks(*args, **kwargs)
|
| 14 |
|
| 15 |
gr.Blocks = PatchedBlocks
|
| 16 |
|
| 17 |
|
| 18 |
# ---------------------------------------------------
|
| 19 |
-
# 🔧 Patch 2: Chatbot ignores deprecated kwargs
|
| 20 |
# ---------------------------------------------------
|
| 21 |
_old_chatbot = gr.Chatbot
|
| 22 |
|
| 23 |
def PatchedChatbot(*args, **kwargs):
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
return _old_chatbot(*args, **kwargs)
|
| 27 |
|
| 28 |
gr.Chatbot = PatchedChatbot
|
|
|
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
# ---------------------------------------------------
|
| 6 |
+
# 🔧 Patch 1: Blocks ignores deprecated kwargs
|
| 7 |
# ---------------------------------------------------
|
| 8 |
_old_blocks = gr.Blocks
|
| 9 |
|
| 10 |
def PatchedBlocks(*args, **kwargs):
|
| 11 |
+
# Remove smolagents old kwargs
|
| 12 |
+
for k in ["theme", "fill_height"]:
|
| 13 |
+
kwargs.pop(k, None)
|
| 14 |
return _old_blocks(*args, **kwargs)
|
| 15 |
|
| 16 |
gr.Blocks = PatchedBlocks
|
| 17 |
|
| 18 |
|
| 19 |
# ---------------------------------------------------
|
| 20 |
+
# 🔧 Patch 2: Chatbot ignores ALL deprecated kwargs
|
| 21 |
# ---------------------------------------------------
|
| 22 |
_old_chatbot = gr.Chatbot
|
| 23 |
|
| 24 |
def PatchedChatbot(*args, **kwargs):
|
| 25 |
+
# Allowed kwargs in Gradio 6 Chatbot:
|
| 26 |
+
allowed = {
|
| 27 |
+
"value", "height", "scale", "min_height", "max_height",
|
| 28 |
+
"rtl", "show_copy_button", "avatar_images",
|
| 29 |
+
"layout","render","visible","interactive"
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
# Strip unsupported ones
|
| 33 |
+
kwargs = {k: v for k, v in kwargs.items() if k in allowed}
|
| 34 |
+
|
| 35 |
return _old_chatbot(*args, **kwargs)
|
| 36 |
|
| 37 |
gr.Chatbot = PatchedChatbot
|