ArceusInception commited on
Commit
cbda721
·
verified ·
1 Parent(s): 01faf32

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -20,7 +20,7 @@ def get_weather_and_insight(city):
20
 
21
  # Generate a creative weather summary using LangChain LLM
22
  groq_api_key = os.getenv("GROQ_API_KEY")
23
- system = f"Local weather update for {city}: {temp}°C, {description}. Provide a fun fact about {city}."
24
  human = "{text}"
25
  prompt = ChatPromptTemplate.from_messages(
26
  [("system", system), ("human", human)]
@@ -32,8 +32,8 @@ def get_weather_and_insight(city):
32
  # Add emojis for visual flair
33
  weather_emoji = "☀️" if "clear" in description else "☁️" if "cloud" in description else "🌧️" if "rain" in description else "❄️" if "snow" in description else "🌫️"
34
 
35
- # Create the final response string, avoiding repetition
36
- final_response = f"🌍 Weather Update for {city}: {temp}°C, {humidity}% humidity, described as {description} {weather_emoji}. Insight: {output}"
37
 
38
  return final_response
39
 
@@ -43,7 +43,7 @@ iface = gr.Interface(
43
  inputs=gr.Textbox(label="Enter City Name", placeholder="Type city here..."),
44
  outputs=gr.Textbox(label="Weather Report and Insight"),
45
  title="WeatherAssistantApp",
46
- description="Enter a city name to get a concise weather report with an AI-generated insight."
47
  )
48
 
49
- iface.launch()
 
20
 
21
  # Generate a creative weather summary using LangChain LLM
22
  groq_api_key = os.getenv("GROQ_API_KEY")
23
+ system = f"You are a local weather reporter bringing the latest update for {city}. Right now, it's \n🌡️ {temp}°C, degrees Celsius with about 💧 {humidity}% percent humidity. The weather of the city can be best described as {description} with a short fun fact."
24
  human = "{text}"
25
  prompt = ChatPromptTemplate.from_messages(
26
  [("system", system), ("human", human)]
 
32
  # Add emojis for visual flair
33
  weather_emoji = "☀️" if "clear" in description else "☁️" if "cloud" in description else "🌧️" if "rain" in description else "❄️" if "snow" in description else "🌫️"
34
 
35
+ # Create the final response string
36
+ final_response = f"🌍 {city.upper()} Weather Insight: {output} {weather_emoji}"
37
 
38
  return final_response
39
 
 
43
  inputs=gr.Textbox(label="Enter City Name", placeholder="Type city here..."),
44
  outputs=gr.Textbox(label="Weather Report and Insight"),
45
  title="WeatherAssistantApp",
46
+ description="Enter a city name to get a detailed weather report with an AI-generated insight."
47
  )
48
 
49
+ iface.launch()