Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
2 |
|
3 |
-
# Google Gemini
|
4 |
-
#from litellm import LiteLLMModel, RateLimitError
|
5 |
|
6 |
import datetime
|
7 |
import requests
|
@@ -9,10 +7,8 @@ import yaml
|
|
9 |
import os
|
10 |
import pytz # Had to give it permission in Code agent
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
from tools.polite_guard import PoliteGuardTool
|
15 |
-
from tools.web_search import DuckDuckGoSearchTool
|
16 |
from check_endpoint import is_huggingface_endpoint
|
17 |
|
18 |
from Gradio_UI import GradioUI
|
@@ -38,17 +34,6 @@ def get_the_current_time_in_timezone(timezone: str) -> str:
|
|
38 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
39 |
|
40 |
|
41 |
-
final_answer = FinalAnswerTool()
|
42 |
-
#@tool
|
43 |
-
polite_guard = PoliteGuardTool()
|
44 |
-
web_search = DuckDuckGoSearchTool()
|
45 |
-
|
46 |
-
|
47 |
-
# Switch to Gemini if this model gets overloaded
|
48 |
-
my_id = 'Qwen/Qwen2.5-Coder-32B-Instruct'
|
49 |
-
# example of an end point
|
50 |
-
#my_id="https://ntqicork29enjoy5.us-east4.gcp.endpoints.huggingface.cloud"
|
51 |
-
|
52 |
|
53 |
my_id = os.getenv("QWEN_URI")
|
54 |
|
@@ -59,7 +44,7 @@ if is_huggingface_endpoint(my_id):
|
|
59 |
print("This is a Hugging Face Inference Endpoint.")
|
60 |
else:
|
61 |
print("This is NOT a Hugging Face Inference Endpoint.")
|
62 |
-
|
63 |
|
64 |
|
65 |
'''
|
|
|
1 |
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
2 |
|
|
|
|
|
3 |
|
4 |
import datetime
|
5 |
import requests
|
|
|
7 |
import os
|
8 |
import pytz # Had to give it permission in Code agent
|
9 |
|
10 |
+
from agents.tools import tools
|
11 |
+
|
|
|
|
|
12 |
from check_endpoint import is_huggingface_endpoint
|
13 |
|
14 |
from Gradio_UI import GradioUI
|
|
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
my_id = os.getenv("QWEN_URI")
|
39 |
|
|
|
44 |
print("This is a Hugging Face Inference Endpoint.")
|
45 |
else:
|
46 |
print("This is NOT a Hugging Face Inference Endpoint.")
|
47 |
+
sys.exit(1) # Stop execution if the endpoint is not valid
|
48 |
|
49 |
|
50 |
'''
|