Spaces:
Paused
Paused
update api
Browse files- Notebook_Ferro.ipynb +14 -2
- app.py +1 -1
- weather.py +2 -2
Notebook_Ferro.ipynb
CHANGED
@@ -44,7 +44,19 @@
|
|
44 |
]
|
45 |
}
|
46 |
],
|
47 |
-
"source": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
},
|
49 |
{
|
50 |
"cell_type": "code",
|
@@ -376,7 +388,7 @@
|
|
376 |
"name": "python",
|
377 |
"nbconvert_exporter": "python",
|
378 |
"pygments_lexer": "ipython3",
|
379 |
-
"version": "3.11.
|
380 |
}
|
381 |
},
|
382 |
"nbformat": 4,
|
|
|
44 |
]
|
45 |
}
|
46 |
],
|
47 |
+
"source": [
|
48 |
+
"open_cage_api = os.getenv(\"OPENCAGE_API_KEY\")\n",
|
49 |
+
"\n",
|
50 |
+
"city = 'Clamart'\n",
|
51 |
+
"\n",
|
52 |
+
"geocode_url = f\"https://api.opencagedata.com/geocode/v1/json?q={city}&key={opencage_api_key}\"\n",
|
53 |
+
"geocode_response = requests.get(geocode_url)\n",
|
54 |
+
"geocode_data = geocode_response.json()\n",
|
55 |
+
"\n",
|
56 |
+
"\n",
|
57 |
+
"latitude = geocode_data['results'][0]['geometry']['lat']\n",
|
58 |
+
"longitude = geocode_data['results'][0]['geometry']['lng']"
|
59 |
+
]
|
60 |
},
|
61 |
{
|
62 |
"cell_type": "code",
|
|
|
388 |
"name": "python",
|
389 |
"nbconvert_exporter": "python",
|
390 |
"pygments_lexer": "ipython3",
|
391 |
+
"version": "3.11.5"
|
392 |
}
|
393 |
},
|
394 |
"nbformat": 4,
|
app.py
CHANGED
@@ -22,7 +22,7 @@ today = today.strftime("%Y-%m-%d")
|
|
22 |
|
23 |
# Load environment variables
|
24 |
load_dotenv()
|
25 |
-
api_key = os.
|
26 |
client = MistralClient(api_key=api_key)
|
27 |
model = 'mistral-small'
|
28 |
|
|
|
22 |
|
23 |
# Load environment variables
|
24 |
load_dotenv()
|
25 |
+
api_key = os.environ('MISTRAL_API_KEY')
|
26 |
client = MistralClient(api_key=api_key)
|
27 |
model = 'mistral-small'
|
28 |
|
weather.py
CHANGED
@@ -10,8 +10,8 @@ load_dotenv()
|
|
10 |
|
11 |
|
12 |
def get_weather(city, date):
|
13 |
-
agro_api_key = os.
|
14 |
-
opencage_api_key = os.
|
15 |
|
16 |
# On récupère les lat et lon de la ville
|
17 |
geocode_url = f"https://api.opencagedata.com/geocode/v1/json?q={city}&key={opencage_api_key}"
|
|
|
10 |
|
11 |
|
12 |
def get_weather(city, date):
|
13 |
+
agro_api_key = os.environ("AGRO_API_KEY")
|
14 |
+
opencage_api_key = os.environ("OPENCAGE_API_KEY")
|
15 |
|
16 |
# On récupère les lat et lon de la ville
|
17 |
geocode_url = f"https://api.opencagedata.com/geocode/v1/json?q={city}&key={opencage_api_key}"
|