Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from weather_utils import get_weather_by_coordinates
|
3 |
+
|
4 |
+
def on_map_click(latlon):
|
5 |
+
lat, lon = latlon
|
6 |
+
return get_weather_by_coordinates(lat, lon)
|
7 |
+
|
8 |
+
with gr.Blocks() as app:
|
9 |
+
gr.Markdown("## 🗺️ Hyderabad Weather Map\nClick anywhere in Hyderabad to see live weather ☁️🌧️☀️")
|
10 |
+
|
11 |
+
map_input = gr.Map(label="Click anywhere on the map", value=(17.3850, 78.4867), zoom=11)
|
12 |
+
output = gr.Markdown()
|
13 |
+
|
14 |
+
map_input.change(fn=on_map_click, inputs=map_input, outputs=output)
|
15 |
+
|
16 |
+
app.launch()
|