Update app.py
Browse files
app.py
CHANGED
|
@@ -2,13 +2,12 @@ import requests
|
|
| 2 |
import gradio as gr
|
| 3 |
import pandas as pd
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
var2 = "2682f6801720ebeb43c93ad55c826c5c"
|
| 8 |
|
| 9 |
def get_weather(city):
|
| 10 |
-
|
| 11 |
-
response = requests.get(
|
| 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>"
|