KAPtechies commited on
Commit
b7f35c7
·
verified ·
1 Parent(s): 81a2f5e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -2,13 +2,12 @@ import requests
2
  import gradio as gr
3
  import pandas as pd
4
 
5
- # OpenWeather API details
6
- var1 = "http://api.openweathermap.org/data/2.5/forecast?"
7
- var2 = "2682f6801720ebeb43c93ad55c826c5c"
8
 
9
  def get_weather(city):
10
- url = f"{var1}q={city}&appid={var2}&units=metric"
11
- response = requests.get(url).json()
12
 
13
  if response.get("cod") != "200":
14
  return "<span style='color:red; font-weight:bold;'>❌ Invalid city name! Please enter a correct city.</span>"
 
2
  import gradio as gr
3
  import pandas as pd
4
 
5
+ var1 = os.getenv("variable_1")
6
+ var2 = os.getenv("variable_2")
 
7
 
8
  def get_weather(city):
9
+ result = f"{var1}q={city}&appid={var2}&units=metric"
10
+ response = requests.get(result).json()
11
 
12
  if response.get("cod") != "200":
13
  return "<span style='color:red; font-weight:bold;'>❌ Invalid city name! Please enter a correct city.</span>"