Spaces:
Sleeping
Sleeping
Add ZeroGPU startup compatibility fix and .gitignore
Browse files- .gitignore +5 -0
- app.py +11 -1
.gitignore
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__pycache__/
|
| 2 |
+
*.py[cod]
|
| 3 |
+
.venv/
|
| 4 |
+
.gradio/
|
| 5 |
+
.env
|
app.py
CHANGED
|
@@ -1,5 +1,15 @@
|
|
| 1 |
import yaml
|
| 2 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
from smolagents import GradioUI, CodeAgent, InferenceClientModel
|
| 4 |
|
| 5 |
# Get current directory path
|
|
@@ -34,7 +44,7 @@ agent = CodeAgent(
|
|
| 34 |
model=model,
|
| 35 |
tools=[web_search, visit_webpage, suggest_menu, catering_service_tool, superhero_party_theme_generator],
|
| 36 |
managed_agents=[],
|
| 37 |
-
max_steps=
|
| 38 |
verbosity_level=2,
|
| 39 |
planning_interval=None,
|
| 40 |
name=None,
|
|
|
|
| 1 |
import yaml
|
| 2 |
import os
|
| 3 |
+
|
| 4 |
+
# 兼容 ZeroGPU 啟動檢查
|
| 5 |
+
try:
|
| 6 |
+
import spaces
|
| 7 |
+
@spaces.GPU
|
| 8 |
+
def _zero_gpu_init():
|
| 9 |
+
pass
|
| 10 |
+
except ImportError:
|
| 11 |
+
pass
|
| 12 |
+
|
| 13 |
from smolagents import GradioUI, CodeAgent, InferenceClientModel
|
| 14 |
|
| 15 |
# Get current directory path
|
|
|
|
| 44 |
model=model,
|
| 45 |
tools=[web_search, visit_webpage, suggest_menu, catering_service_tool, superhero_party_theme_generator],
|
| 46 |
managed_agents=[],
|
| 47 |
+
max_steps=30,
|
| 48 |
verbosity_level=2,
|
| 49 |
planning_interval=None,
|
| 50 |
name=None,
|