Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,6 @@ import os
|
|
| 8 |
API_KEY = os.environ["HF_API_KEY"]
|
| 9 |
MODEL_ID = "duongtruongbinh/smolagents-weather-agent"
|
| 10 |
client = InferenceClient(API_KEY)
|
| 11 |
-
model = client.model(MODEL_ID) # Get callable model
|
| 12 |
|
| 13 |
# ------------------- STREAMLIT PAGE -------------------
|
| 14 |
st.set_page_config(page_title="Weather Forecast App", page_icon="⛅", layout="wide")
|
|
@@ -25,7 +24,9 @@ city = st.text_input("🌍 Enter city name", "London")
|
|
| 25 |
if city:
|
| 26 |
with st.spinner("Fetching weather data..."):
|
| 27 |
try:
|
| 28 |
-
|
|
|
|
|
|
|
| 29 |
if "error" in response:
|
| 30 |
st.error("City not found or API issue. Try again!")
|
| 31 |
else:
|
|
|
|
| 8 |
API_KEY = os.environ["HF_API_KEY"]
|
| 9 |
MODEL_ID = "duongtruongbinh/smolagents-weather-agent"
|
| 10 |
client = InferenceClient(API_KEY)
|
|
|
|
| 11 |
|
| 12 |
# ------------------- STREAMLIT PAGE -------------------
|
| 13 |
st.set_page_config(page_title="Weather Forecast App", page_icon="⛅", layout="wide")
|
|
|
|
| 24 |
if city:
|
| 25 |
with st.spinner("Fetching weather data..."):
|
| 26 |
try:
|
| 27 |
+
# ✅ Use text2text instead of client.model()
|
| 28 |
+
response = client.text2text(model=MODEL_ID, inputs={"location": city})
|
| 29 |
+
|
| 30 |
if "error" in response:
|
| 31 |
st.error("City not found or API issue. Try again!")
|
| 32 |
else:
|