vigneshgautam commited on
Commit
5d17183
·
verified ·
1 Parent(s): c40e9ef

import API_KEY to the main program

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -1,6 +1,12 @@
1
  import requests
2
  import gradio as gr
3
 
 
 
 
 
 
 
4
  # Function to get weather data
5
  def get_weather(city_name):
6
  base_url = "http://api.openweathermap.org/data/2.5/weather"
 
1
  import requests
2
  import gradio as gr
3
 
4
+ from dotenv import load_dotenv
5
+ import os
6
+
7
+ load_dotenv() # Load variables from .env
8
+ API_KEY = os.getenv("API_KEY") # Access the API_KEY
9
+
10
  # Function to get weather data
11
  def get_weather(city_name):
12
  base_url = "http://api.openweathermap.org/data/2.5/weather"