Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,10 +8,10 @@ from Gradio_UI import GradioUI
|
|
| 8 |
@tool
|
| 9 |
def get_snowfall_forecast(city: str, date: str) -> str:
|
| 10 |
"""
|
| 11 |
-
|
| 12 |
|
| 13 |
-
|
| 14 |
-
city (str): The name of the city
|
| 15 |
date (str): The date in YYYY-MM-DD format for which the snowfall forecast is needed.
|
| 16 |
|
| 17 |
Returns:
|
|
@@ -39,25 +39,4 @@ def get_snowfall_forecast(city: str, date: str) -> str:
|
|
| 39 |
return f"No snowfall data available for {city} on {date}."
|
| 40 |
|
| 41 |
except Exception as e:
|
| 42 |
-
return f"Error fetching snowfall forecast: {str(e
|
| 43 |
-
|
| 44 |
-
# ✅ Load the Final Answer Tool
|
| 45 |
-
final_answer = FinalAnswerTool()
|
| 46 |
-
|
| 47 |
-
# ✅ Load the Language Model
|
| 48 |
-
model = HfApiModel(
|
| 49 |
-
max_tokens=2096,
|
| 50 |
-
temperature=0.5,
|
| 51 |
-
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
|
| 52 |
-
)
|
| 53 |
-
|
| 54 |
-
# ✅ Create the AI Agent with Tools
|
| 55 |
-
agent = CodeAgent(
|
| 56 |
-
model=model,
|
| 57 |
-
tools=[final_answer, get_snowfall_forecast], # Snowfall Forecast Tool Added
|
| 58 |
-
max_steps=6,
|
| 59 |
-
verbosity_level=1,
|
| 60 |
-
)
|
| 61 |
-
|
| 62 |
-
# ✅ Launch the Gradio UI
|
| 63 |
-
GradioUI(agent).launch()
|
|
|
|
| 8 |
@tool
|
| 9 |
def get_snowfall_forecast(city: str, date: str) -> str:
|
| 10 |
"""
|
| 11 |
+
Fetch the expected snowfall in a given city on a specific date.
|
| 12 |
|
| 13 |
+
Args:
|
| 14 |
+
city (str): The name of the city to get the snowfall forecast for. Example: "Denver".
|
| 15 |
date (str): The date in YYYY-MM-DD format for which the snowfall forecast is needed.
|
| 16 |
|
| 17 |
Returns:
|
|
|
|
| 39 |
return f"No snowfall data available for {city} on {date}."
|
| 40 |
|
| 41 |
except Exception as e:
|
| 42 |
+
return f"Error fetching snowfall forecast: {str(e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|