Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
5d2662c
1
Parent(s):
a72b7d8
feat: upgrade to Gradio 4.0.0 with compatibility shims and added plotly dependency
Browse files- Update Gradio version from 3.50.2 to 4.0.0 across README.md and spaces.yaml
- Update requirements.txt to require gradio>=4.0.0 and add plotly>=5.0.0
- Add compatibility layer in app.py with themes attribute and launch() mock
- Maintain backward compatibility during transition period
- README.md +1 -1
- app.py +11 -0
- requirements.txt +2 -1
- spaces.yaml +1 -1
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: "🤖"
|
|
| 4 |
colorFrom: "blue"
|
| 5 |
colorTo: "purple"
|
| 6 |
sdk: "gradio"
|
| 7 |
-
sdk_version: "
|
| 8 |
app_file: "app.py"
|
| 9 |
pinned: false
|
| 10 |
---
|
|
|
|
| 4 |
colorFrom: "blue"
|
| 5 |
colorTo: "purple"
|
| 6 |
sdk: "gradio"
|
| 7 |
+
sdk_version: "4.0.0"
|
| 8 |
app_file: "app.py"
|
| 9 |
pinned: false
|
| 10 |
---
|
app.py
CHANGED
|
@@ -80,6 +80,14 @@ except ImportError as e:
|
|
| 80 |
self.Tabs = self._mock_tabs
|
| 81 |
self.TabItem = self._mock_tab_item
|
| 82 |
self.Blocks = self._mock_blocks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
def _mock_blocks(self, *args, **kwargs):
|
| 85 |
class MockBlocksContext:
|
|
@@ -87,6 +95,9 @@ except ImportError as e:
|
|
| 87 |
return self
|
| 88 |
def __exit__(self, *args):
|
| 89 |
pass
|
|
|
|
|
|
|
|
|
|
| 90 |
return MockBlocksContext()
|
| 91 |
|
| 92 |
def _mock_interface(self, fn, inputs, outputs, title=None, description=None, theme=None):
|
|
|
|
| 80 |
self.Tabs = self._mock_tabs
|
| 81 |
self.TabItem = self._mock_tab_item
|
| 82 |
self.Blocks = self._mock_blocks
|
| 83 |
+
# Add themes attribute for compatibility
|
| 84 |
+
self.themes = self._mock_themes()
|
| 85 |
+
|
| 86 |
+
def _mock_themes(self):
|
| 87 |
+
class MockThemes:
|
| 88 |
+
def GoogleFont(self, font_name):
|
| 89 |
+
return font_name
|
| 90 |
+
return MockThemes()
|
| 91 |
|
| 92 |
def _mock_blocks(self, *args, **kwargs):
|
| 93 |
class MockBlocksContext:
|
|
|
|
| 95 |
return self
|
| 96 |
def __exit__(self, *args):
|
| 97 |
pass
|
| 98 |
+
def launch(self, *args, **kwargs):
|
| 99 |
+
# Mock launch method for compatibility
|
| 100 |
+
pass
|
| 101 |
return MockBlocksContext()
|
| 102 |
|
| 103 |
def _mock_interface(self, fn, inputs, outputs, title=None, description=None, theme=None):
|
requirements.txt
CHANGED
|
@@ -71,7 +71,8 @@ transformers>=4.20.0
|
|
| 71 |
# Web framework (optional for deployment)
|
| 72 |
fastapi>=0.85.0
|
| 73 |
uvicorn>=0.18.0
|
| 74 |
-
gradio>=
|
|
|
|
| 75 |
|
| 76 |
# Message queuing (optional for scaling)
|
| 77 |
celery>=5.2.0
|
|
|
|
| 71 |
# Web framework (optional for deployment)
|
| 72 |
fastapi>=0.85.0
|
| 73 |
uvicorn>=0.18.0
|
| 74 |
+
gradio>=4.0.0
|
| 75 |
+
plotly>=5.0.0
|
| 76 |
|
| 77 |
# Message queuing (optional for scaling)
|
| 78 |
celery>=5.2.0
|
spaces.yaml
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
|
| 4 |
title: "Secure AI Agents Suite"
|
| 5 |
sdk: "gradio"
|
| 6 |
-
sdk_version: "
|
| 7 |
|
| 8 |
# Hardware requirements and optimization
|
| 9 |
hardware: "cpu-basic" # Options: cpu-basic, cpu-upgrade, gpu-t4, gpu-a10g, gpu-a100
|
|
|
|
| 3 |
|
| 4 |
title: "Secure AI Agents Suite"
|
| 5 |
sdk: "gradio"
|
| 6 |
+
sdk_version: "4.0.0"
|
| 7 |
|
| 8 |
# Hardware requirements and optimization
|
| 9 |
hardware: "cpu-basic" # Options: cpu-basic, cpu-upgrade, gpu-t4, gpu-a10g, gpu-a100
|