grevy commited on
Commit
00dc8a5
·
1 Parent(s): 8c5c24b

Fix zeroGPU.

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -4,6 +4,7 @@ import requests
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
 
7
 
8
  from Gradio_UI import GradioUI
9
 
@@ -45,7 +46,10 @@ temperature=0.5,
45
  model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
46
  custom_role_conversions=None,
47
  )
48
-
 
 
 
49
 
50
  # Import tool from Hub
51
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
@@ -53,7 +57,7 @@ image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_co
53
  with open("prompts.yaml", 'r') as stream:
54
  prompt_templates = yaml.safe_load(stream)
55
 
56
- agent = CodeAgent(
57
  model=model,
58
  tools=[final_answer], ## add your tools here (don't remove final answer)
59
  max_steps=6,
 
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
+ import spaces
8
 
9
  from Gradio_UI import GradioUI
10
 
 
46
  model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
47
  custom_role_conversions=None,
48
  )
49
+ class ZeroGPUCodeAgent(CodeAgent):
50
+ @spaces.GPU
51
+ def run(self, *args, **kwargs):
52
+ return super().run(*args, **kwargs)
53
 
54
  # Import tool from Hub
55
  image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
 
57
  with open("prompts.yaml", 'r') as stream:
58
  prompt_templates = yaml.safe_load(stream)
59
 
60
+ agent = ZeroGPUCodeAgent(
61
  model=model,
62
  tools=[final_answer], ## add your tools here (don't remove final answer)
63
  max_steps=6,