smainye commited on
Commit
d8ce3a6
·
verified ·
1 Parent(s): 82611be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -38,6 +38,19 @@ def get_nairobi_weather() -> str:
38
  except KeyError:
39
  return "⚠️ Error processing weather data"
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  @tool
42
  def get_current_time_in_timezone(timezone: str) -> str:
43
  """A tool that fetches the current local time in a specified timezone.
 
38
  except KeyError:
39
  return "⚠️ Error processing weather data"
40
 
41
+ # Create the interface
42
+ with gr.Blocks(title="Nairobi Weather") as demo:
43
+ gr.Markdown("# 🌤️ Current Weather in Nairobi")
44
+ with gr.Row():
45
+ weather_output = gr.Textbox(label="Weather Report", interactive=False)
46
+ refresh_btn = gr.Button("Refresh Data")
47
+ refresh_btn.click(fn=get_nairobi_weather, outputs=weather_output)
48
+
49
+ # Display initial data
50
+ demo.load(fn=get_nairobi_weather, outputs=weather_output)
51
+
52
+ demo.launch()
53
+
54
  @tool
55
  def get_current_time_in_timezone(timezone: str) -> str:
56
  """A tool that fetches the current local time in a specified timezone.