ppujari commited on
Commit
73b5cac
·
verified ·
1 Parent(s): 954b36f
Files changed (1) hide show
  1. app.py +2 -39
app.py CHANGED
@@ -1,16 +1,14 @@
1
- !pip install selenium
2
 
3
- from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
4
  import datetime
5
  import requests
6
  import pytz
7
  import yaml
8
- from tools.final_answer import FinalAnswerTool
9
  from selenium.webdriver.common.by import By
10
  from selenium.webdriver.common.keys import Keys
11
  import time
12
 
13
- from Gradio_UI import GradioUI
14
 
15
  # Set credentials (replace with actual details)
16
  USERNAME = "pradeepp@rocketmail.com"
@@ -95,38 +93,3 @@ def get_current_time_in_timezone(timezone: str) -> str:
95
  return f"The current local time in {timezone} is: {local_time}"
96
  except Exception as e:
97
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
98
-
99
-
100
- final_answer = FinalAnswerTool()
101
-
102
- # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
103
- # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
104
-
105
- model = HfApiModel(
106
- max_tokens=2096,
107
- temperature=0.5,
108
- model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
109
- custom_role_conversions=None,
110
- )
111
-
112
-
113
- # Import tool from Hub
114
- image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
115
-
116
- with open("prompts.yaml", 'r') as stream:
117
- prompt_templates = yaml.safe_load(stream)
118
-
119
- agent = CodeAgent(
120
- model=model,
121
- tools=[final_answer,image_generation_tool], ## add your tools here (don't remove final answer)
122
- max_steps=6,
123
- verbosity_level=1,
124
- grammar=None,
125
- planning_interval=None,
126
- name=None,
127
- description=None,
128
- prompt_templates=prompt_templates
129
- )
130
-
131
-
132
- GradioUI(agent).launch()
 
1
+ #!pip install selenium
2
 
3
+ from smolagents import CodeAgent, HfApiModel,load_tool,tool
4
  import datetime
5
  import requests
6
  import pytz
7
  import yaml
 
8
  from selenium.webdriver.common.by import By
9
  from selenium.webdriver.common.keys import Keys
10
  import time
11
 
 
12
 
13
  # Set credentials (replace with actual details)
14
  USERNAME = "pradeepp@rocketmail.com"
 
93
  return f"The current local time in {timezone} is: {local_time}"
94
  except Exception as e:
95
  return f"Error fetching time for timezone '{timezone}': {str(e)}"