ykl910 commited on
Commit
aff151b
·
verified ·
1 Parent(s): 7f09a1f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -3
app.py CHANGED
@@ -3,16 +3,29 @@ import os
3
  import gradio as gr
4
 
5
  # ---------------------------------------------------
6
- # 🔧 Patch: Make gr.Blocks ignore "theme" for Gradio 6
7
  # ---------------------------------------------------
8
  _old_blocks = gr.Blocks
9
 
10
  def PatchedBlocks(*args, **kwargs):
11
- kwargs.pop("theme", None) # Remove unsupported kwarg
12
- kwargs.pop("fill_height", None) # Remove if smolagents uses this too
13
  return _old_blocks(*args, **kwargs)
14
 
15
  gr.Blocks = PatchedBlocks
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  # ---------------------------------------------------
17
 
18
 
 
3
  import gradio as gr
4
 
5
  # ---------------------------------------------------
6
+ # 🔧 Patch 1: Blocks ignores old kwargs
7
  # ---------------------------------------------------
8
  _old_blocks = gr.Blocks
9
 
10
  def PatchedBlocks(*args, **kwargs):
11
+ kwargs.pop("theme", None)
12
+ kwargs.pop("fill_height", None)
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
+ kwargs.pop("type", None) # removed in Gradio 6
25
+ kwargs.pop("like", None) # sometimes causes issues too
26
+ return _old_chatbot(*args, **kwargs)
27
+
28
+ gr.Chatbot = PatchedChatbot
29
  # ---------------------------------------------------
30
 
31