abdullahzunorain
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,187 +1,3 @@
|
|
1 |
-
# import requests
|
2 |
-
# import streamlit as st
|
3 |
-
# import groq
|
4 |
-
|
5 |
-
# # Access API keys from Streamlit secrets
|
6 |
-
# openweather_api_key = st.secrets["weather_api_key"]
|
7 |
-
# groq_api_key = st.secrets["groq_api_key"]
|
8 |
-
|
9 |
-
# # Function to get weather data from OpenWeatherMap
|
10 |
-
# def get_weather_data(city):
|
11 |
-
# api_key = openweather_api_key # Use the secret API key
|
12 |
-
# url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
|
13 |
-
# try:
|
14 |
-
# response = requests.get(url)
|
15 |
-
# response.raise_for_status() # Raise an HTTPError if the HTTP request returned an unsuccessful status code
|
16 |
-
# return response.json()
|
17 |
-
# except requests.exceptions.HTTPError as err:
|
18 |
-
# st.error(f"HTTP error occurred: {err}")
|
19 |
-
# except Exception as err:
|
20 |
-
# st.error(f"An error occurred: {err}")
|
21 |
-
# return None
|
22 |
-
|
23 |
-
# # Function to parse weather data and categorize weather
|
24 |
-
# def parse_weather_data(weather_data):
|
25 |
-
# temperature = weather_data["main"]["temp"]
|
26 |
-
# weather_description = weather_data["weather"][0]["description"]
|
27 |
-
# return temperature, weather_description
|
28 |
-
|
29 |
-
# # Categorizing weather conditions
|
30 |
-
# def categorize_weather(description):
|
31 |
-
# description = description.lower()
|
32 |
-
# if "clear" in description or "sun" in description:
|
33 |
-
# return "Sunny", "☀️"
|
34 |
-
# elif "rain" in description or "drizzle" in description or "shower" in description:
|
35 |
-
# return "Rainy", "🌧️"
|
36 |
-
# elif "snow" in description or "sleet" in description:
|
37 |
-
# return "Cold", "❄️"
|
38 |
-
# elif "cloud" in description:
|
39 |
-
# return "Cloudy", "☁️"
|
40 |
-
# elif "wind" in description:
|
41 |
-
# return "Windy", "💨"
|
42 |
-
# elif "smoke" in description or "haze" in description:
|
43 |
-
# return "Smoky", "🌫️"
|
44 |
-
# else:
|
45 |
-
# return "Uncategorized", "🔍"
|
46 |
-
|
47 |
-
# # Function to get outfit suggestion using Groq's LLaMA model
|
48 |
-
# def get_outfit_suggestion(temperature, description, style, fabric, weather_category, weather_icon):
|
49 |
-
# # Initialize Groq's API
|
50 |
-
# try:
|
51 |
-
# client = groq.Groq(api_key=groq_api_key) # Use the secret API key
|
52 |
-
|
53 |
-
# # Adjust the prompt based on the weather category and custom style
|
54 |
-
# prompt = f"The current weather is {description} with a temperature of {temperature}°C. The weather category is {weather_category}. Suggest an outfit. The user prefers a {style} style and {fabric} fabric."
|
55 |
-
|
56 |
-
# # Use Groq's chat completion to get the text response
|
57 |
-
# response = client.chat.completions.create(
|
58 |
-
# messages=[{"role": "user", "content": prompt}],
|
59 |
-
# model="llama3-8b-8192", # Change to a valid Groq model if necessary
|
60 |
-
# )
|
61 |
-
# return response.choices[0].message.content.strip(), weather_icon
|
62 |
-
# except Exception as e:
|
63 |
-
# st.error(f"Error using Groq API: {e}")
|
64 |
-
# return None, None
|
65 |
-
|
66 |
-
# # Streamlit UI for user input
|
67 |
-
# st.set_page_config(page_title="Weather-Based Outfit Suggestion", page_icon="🌤️", layout="wide")
|
68 |
-
|
69 |
-
# # Custom styles
|
70 |
-
# st.markdown("""
|
71 |
-
# <style>
|
72 |
-
# .reportview-container {
|
73 |
-
# background: linear-gradient(135deg, #ffcc00, #ff7b00);
|
74 |
-
# }
|
75 |
-
# .stButton>button {
|
76 |
-
# background-color: #ff5733;
|
77 |
-
# color: white;
|
78 |
-
# font-size: 18px;
|
79 |
-
# border-radius: 10px;
|
80 |
-
# padding: 10px;
|
81 |
-
# }
|
82 |
-
# .stTextInput input {
|
83 |
-
# font-size: 16px;
|
84 |
-
# padding: 10px;
|
85 |
-
# border-radius: 10px;
|
86 |
-
# }
|
87 |
-
# .stSelectbox select {
|
88 |
-
# font-size: 16px;
|
89 |
-
# padding: 10px;
|
90 |
-
# border-radius: 10px;
|
91 |
-
# }
|
92 |
-
# .stWrite, .stImage {
|
93 |
-
# font-family: "Arial", sans-serif;
|
94 |
-
# font-size: 18px;
|
95 |
-
# color: #333;
|
96 |
-
# }
|
97 |
-
# .weather-header {
|
98 |
-
# text-align: center;
|
99 |
-
# font-size: 36px;
|
100 |
-
# color: #ffffff;
|
101 |
-
# font-family: "Arial", sans-serif;
|
102 |
-
# }
|
103 |
-
# .outfit-header {
|
104 |
-
# font-size: 24px;
|
105 |
-
# color: #444;
|
106 |
-
# font-family: "Arial", sans-serif;
|
107 |
-
# margin-top: 30px;
|
108 |
-
# }
|
109 |
-
# </style>
|
110 |
-
# """, unsafe_allow_html=True)
|
111 |
-
|
112 |
-
# st.title("🌤️ Weather-Based Outfit Suggestion App")
|
113 |
-
|
114 |
-
# # User input
|
115 |
-
# city = st.text_input("Enter your location:", placeholder="E.g. Peshawar")
|
116 |
-
|
117 |
-
# # Gender selection
|
118 |
-
# gender = st.selectbox("Select your gender", ["Male", "Female", "Other"])
|
119 |
-
|
120 |
-
# # Custom style input
|
121 |
-
# custom_style = st.text_input("Enter your personalized style (optional)", placeholder="E.g. Vintage, Sporty")
|
122 |
-
|
123 |
-
# # If no custom style is provided, default to the selected style
|
124 |
-
# style = custom_style if custom_style else st.selectbox("Select your preferred style", ["Casual", "Formal", "Sporty", "Business", "Chic"])
|
125 |
-
|
126 |
-
# # Fabric preference
|
127 |
-
# fabric = st.selectbox("Select your preferred fabric", ["Cotton", "Linen", "Wool", "Polyester", "Silk", "Leather"])
|
128 |
-
|
129 |
-
# if city:
|
130 |
-
# weather_data = get_weather_data(city)
|
131 |
-
|
132 |
-
# if weather_data and weather_data["cod"] == 200:
|
133 |
-
# temperature, description = parse_weather_data(weather_data)
|
134 |
-
# # Categorize the weather
|
135 |
-
# weather_category, weather_icon = categorize_weather(description)
|
136 |
-
|
137 |
-
# # Display current weather info
|
138 |
-
# st.write(f"Current temperature in {city}: {temperature}°C")
|
139 |
-
# st.write(f"Weather: {description} {weather_icon}")
|
140 |
-
# st.write(f"Weather Category: {weather_category} {weather_icon}")
|
141 |
-
|
142 |
-
# # Get outfit suggestion based on user preferences
|
143 |
-
# outfit_suggestion, weather_icon = get_outfit_suggestion(temperature, description, style, fabric, weather_category, weather_icon)
|
144 |
-
|
145 |
-
# if outfit_suggestion:
|
146 |
-
# # Display outfit suggestion
|
147 |
-
# st.markdown(f"### 🌟 Outfit Suggestion 🌟")
|
148 |
-
# st.write(outfit_suggestion)
|
149 |
-
|
150 |
-
# # Additional section for Health and Comfort Tips
|
151 |
-
# st.markdown(f"### 🌿 Health & Comfort Tips 🌿")
|
152 |
-
# st.write(f"Given the {weather_category} weather, it's important to take care of your health:")
|
153 |
-
# st.write("- **Breathing**: A face mask or scarf covering your nose and mouth can help protect you from smoke inhalation.")
|
154 |
-
# st.write("- **Hydration**: Keep a water bottle with you, as smoke can dehydrate your body.")
|
155 |
-
# st.write("- **Rest**: Try to avoid strenuous activity outdoors and take breaks if you're feeling fatigued.")
|
156 |
-
# st.write("- **Eyes**: If you're feeling irritated, use eye drops to soothe any discomfort caused by smoke.")
|
157 |
-
|
158 |
-
# # Display weather icon
|
159 |
-
# icon_code = weather_data["weather"][0]["icon"]
|
160 |
-
# icon_url = f"http://openweathermap.org/img/wn/{icon_code}.png"
|
161 |
-
# st.image(icon_url)
|
162 |
-
# else:
|
163 |
-
# st.write("Could not retrieve weather data. Please check the location.")
|
164 |
-
|
165 |
-
# # Optional: Add CSS for styling
|
166 |
-
# st.markdown(
|
167 |
-
# """
|
168 |
-
# <style>
|
169 |
-
# .stButton>button {
|
170 |
-
# background-color: #ff5733;
|
171 |
-
# color: white;
|
172 |
-
# }
|
173 |
-
# </style>
|
174 |
-
# """,
|
175 |
-
# unsafe_allow_html=True
|
176 |
-
# )
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
import requests
|
186 |
import streamlit as st
|
187 |
import groq
|
@@ -229,13 +45,13 @@ def categorize_weather(description):
|
|
229 |
return "Uncategorized", "🔍"
|
230 |
|
231 |
# Function to get outfit suggestion using Groq's LLaMA model
|
232 |
-
def get_outfit_suggestion(temperature, description, style, fabric, weather_category, weather_icon):
|
233 |
# Initialize Groq's API
|
234 |
try:
|
235 |
client = groq.Groq(api_key=groq_api_key) # Use the secret API key
|
236 |
|
237 |
# Adjust the prompt based on the weather category
|
238 |
-
prompt = f"The current weather is {description} with a temperature of {temperature}°C. The weather category is {weather_category}. Suggest an outfit. The user prefers a {style} style and {fabric} fabric."
|
239 |
|
240 |
# Use Groq's chat completion to get the text response
|
241 |
response = client.chat.completions.create(
|
@@ -309,11 +125,14 @@ with col1:
|
|
309 |
gender = st.selectbox("Select your gender", ["Male", "Female"])
|
310 |
personalized_style = st.text_input("Enter your personalized style (optional)", placeholder="E.g. Peshawari")
|
311 |
fabric = st.selectbox("Select your preferred fabric", ["Cotton", "Linen", "Wool", "Polyester", "Silk", "Leather"])
|
|
|
|
|
312 |
|
313 |
# Result display in the right column (col2)
|
314 |
with col2:
|
315 |
if city:
|
316 |
-
|
|
|
317 |
|
318 |
if weather_data and weather_data["cod"] == 200:
|
319 |
temperature, description = parse_weather_data(weather_data)
|
@@ -326,7 +145,7 @@ with col2:
|
|
326 |
st.write(f"Weather Category: {weather_category} {weather_icon}")
|
327 |
|
328 |
# Get outfit suggestion based on user preferences
|
329 |
-
outfit_suggestion, weather_icon = get_outfit_suggestion(temperature, description, personalized_style, fabric, weather_category, weather_icon)
|
330 |
|
331 |
if outfit_suggestion:
|
332 |
# Display outfit suggestion
|
@@ -349,6 +168,178 @@ with col2:
|
|
349 |
st.write("Could not retrieve weather data. Please check the location.")
|
350 |
|
351 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
353 |
|
354 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import requests
|
2 |
import streamlit as st
|
3 |
import groq
|
|
|
45 |
return "Uncategorized", "🔍"
|
46 |
|
47 |
# Function to get outfit suggestion using Groq's LLaMA model
|
48 |
+
def get_outfit_suggestion(temperature, description, style, fabric, weather_category, weather_icon, time_of_day, activity):
|
49 |
# Initialize Groq's API
|
50 |
try:
|
51 |
client = groq.Groq(api_key=groq_api_key) # Use the secret API key
|
52 |
|
53 |
# Adjust the prompt based on the weather category
|
54 |
+
prompt = f"The current weather is {description} with a temperature of {temperature}°C. The weather category is {weather_category}. The time of day is {time_of_day} and the user is planning to do {activity}. Suggest an outfit. The user prefers a {style} style and {fabric} fabric."
|
55 |
|
56 |
# Use Groq's chat completion to get the text response
|
57 |
response = client.chat.completions.create(
|
|
|
125 |
gender = st.selectbox("Select your gender", ["Male", "Female"])
|
126 |
personalized_style = st.text_input("Enter your personalized style (optional)", placeholder="E.g. Peshawari")
|
127 |
fabric = st.selectbox("Select your preferred fabric", ["Cotton", "Linen", "Wool", "Polyester", "Silk", "Leather"])
|
128 |
+
time_of_day = st.selectbox("Select time of day", ["Morning", "Afternoon", "Evening"])
|
129 |
+
activity = st.selectbox("Select your activity", ["Work", "Outdoor", "Casual", "Exercise", "Other"])
|
130 |
|
131 |
# Result display in the right column (col2)
|
132 |
with col2:
|
133 |
if city:
|
134 |
+
with st.spinner("Fetching weather data..."):
|
135 |
+
weather_data = get_weather_data(city)
|
136 |
|
137 |
if weather_data and weather_data["cod"] == 200:
|
138 |
temperature, description = parse_weather_data(weather_data)
|
|
|
145 |
st.write(f"Weather Category: {weather_category} {weather_icon}")
|
146 |
|
147 |
# Get outfit suggestion based on user preferences
|
148 |
+
outfit_suggestion, weather_icon = get_outfit_suggestion(temperature, description, personalized_style, fabric, weather_category, weather_icon, time_of_day, activity)
|
149 |
|
150 |
if outfit_suggestion:
|
151 |
# Display outfit suggestion
|
|
|
168 |
st.write("Could not retrieve weather data. Please check the location.")
|
169 |
|
170 |
|
171 |
+
|
172 |
+
|
173 |
+
|
174 |
+
|
175 |
+
|
176 |
+
# import requests
|
177 |
+
# import streamlit as st
|
178 |
+
# import groq
|
179 |
+
|
180 |
+
# # Access API keys from Streamlit secrets
|
181 |
+
# openweather_api_key = st.secrets["weather_api_key"]
|
182 |
+
# groq_api_key = st.secrets["groq_api_key"]
|
183 |
+
|
184 |
+
# # Function to get weather data from OpenWeatherMap
|
185 |
+
# def get_weather_data(city):
|
186 |
+
# api_key = openweather_api_key # Use the secret API key
|
187 |
+
# url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
|
188 |
+
# try:
|
189 |
+
# response = requests.get(url)
|
190 |
+
# response.raise_for_status() # Raise an HTTPError if the HTTP request returned an unsuccessful status code
|
191 |
+
# return response.json()
|
192 |
+
# except requests.exceptions.HTTPError as err:
|
193 |
+
# st.error(f"HTTP error occurred: {err}")
|
194 |
+
# except Exception as err:
|
195 |
+
# st.error(f"An error occurred: {err}")
|
196 |
+
# return None
|
197 |
+
|
198 |
+
# # Function to parse weather data and categorize weather
|
199 |
+
# def parse_weather_data(weather_data):
|
200 |
+
# temperature = weather_data["main"]["temp"]
|
201 |
+
# weather_description = weather_data["weather"][0]["description"]
|
202 |
+
# return temperature, weather_description
|
203 |
+
|
204 |
+
# # Categorizing weather conditions
|
205 |
+
# def categorize_weather(description):
|
206 |
+
# description = description.lower()
|
207 |
+
# if "clear" in description or "sun" in description:
|
208 |
+
# return "Sunny", "☀️"
|
209 |
+
# elif "rain" in description or "drizzle" in description or "shower" in description:
|
210 |
+
# return "Rainy", "🌧️"
|
211 |
+
# elif "snow" in description or "sleet" in description:
|
212 |
+
# return "Cold", "❄️"
|
213 |
+
# elif "cloud" in description:
|
214 |
+
# return "Cloudy", "☁️"
|
215 |
+
# elif "wind" in description:
|
216 |
+
# return "Windy", "💨"
|
217 |
+
# elif "smoke" in description or "haze" in description:
|
218 |
+
# return "Smoky", "🌫️"
|
219 |
+
# else:
|
220 |
+
# return "Uncategorized", "🔍"
|
221 |
+
|
222 |
+
# # Function to get outfit suggestion using Groq's LLaMA model
|
223 |
+
# def get_outfit_suggestion(temperature, description, style, fabric, weather_category, weather_icon):
|
224 |
+
# # Initialize Groq's API
|
225 |
+
# try:
|
226 |
+
# client = groq.Groq(api_key=groq_api_key) # Use the secret API key
|
227 |
+
|
228 |
+
# # Adjust the prompt based on the weather category
|
229 |
+
# prompt = f"The current weather is {description} with a temperature of {temperature}°C. The weather category is {weather_category}. Suggest an outfit. The user prefers a {style} style and {fabric} fabric."
|
230 |
+
|
231 |
+
# # Use Groq's chat completion to get the text response
|
232 |
+
# response = client.chat.completions.create(
|
233 |
+
# messages=[{"role": "user", "content": prompt}],
|
234 |
+
# model="llama3-8b-8192", # Change to a valid Groq model if necessary
|
235 |
+
# )
|
236 |
+
# return response.choices[0].message.content.strip(), weather_icon
|
237 |
+
# except Exception as e:
|
238 |
+
# st.error(f"Error using Groq API: {e}")
|
239 |
+
# return None, None
|
240 |
+
|
241 |
+
# # Streamlit UI for user input
|
242 |
+
# st.set_page_config(page_title="Weather-Based Outfit Suggestion", page_icon="🌤️", layout="wide")
|
243 |
+
|
244 |
+
# # Custom styles
|
245 |
+
# st.markdown("""<style>
|
246 |
+
# .reportview-container {
|
247 |
+
# background: linear-gradient(135deg, #ffcc00, #ff7b00);
|
248 |
+
# }
|
249 |
+
# .stButton>button {
|
250 |
+
# background-color: #ff5733;
|
251 |
+
# color: white;
|
252 |
+
# font-size: 18px;
|
253 |
+
# border-radius: 10px;
|
254 |
+
# padding: 10px;
|
255 |
+
# }
|
256 |
+
# .stTextInput input {
|
257 |
+
# font-size: 16px;
|
258 |
+
# padding: 10px;
|
259 |
+
# border-radius: 10px;
|
260 |
+
# }
|
261 |
+
# .stSelectbox select {
|
262 |
+
# font-size: 16px;
|
263 |
+
# padding: 10px;
|
264 |
+
# border-radius: 10px;
|
265 |
+
# }
|
266 |
+
# .stWrite, .stImage {
|
267 |
+
# font-family: "Arial", sans-serif;
|
268 |
+
# font-size: 18px;
|
269 |
+
# color: #333;
|
270 |
+
# }
|
271 |
+
# .weather-header {
|
272 |
+
# text-align: center;
|
273 |
+
# font-size: 36px;
|
274 |
+
# color: #ffffff;
|
275 |
+
# font-family: "Arial", sans-serif;
|
276 |
+
# }
|
277 |
+
# .outfit-header {
|
278 |
+
# font-size: 24px;
|
279 |
+
# color: #444;
|
280 |
+
# font-family: "Arial", sans-serif;
|
281 |
+
# margin-top: 30px;
|
282 |
+
# }
|
283 |
+
# .left-column {
|
284 |
+
# padding-right: 20px;
|
285 |
+
# }
|
286 |
+
# .right-column {
|
287 |
+
# padding-left: 20px;
|
288 |
+
# }
|
289 |
+
# </style>""", unsafe_allow_html=True)
|
290 |
+
|
291 |
+
# # Title and layout for columns
|
292 |
+
# st.title("🌤️ Weather-Based Outfit Suggestion App")
|
293 |
+
|
294 |
+
# # Create two columns: one for the user input and one for displaying results
|
295 |
+
# col1, col2 = st.columns([1, 2]) # 1: left column (user input), 2: right column (outfit suggestions)
|
296 |
+
|
297 |
+
# # User input in the left column (col1)
|
298 |
+
# with col1:
|
299 |
+
# city = st.text_input("Enter your location:", placeholder="E.g. Peshawar")
|
300 |
+
# gender = st.selectbox("Select your gender", ["Male", "Female"])
|
301 |
+
# personalized_style = st.text_input("Enter your personalized style (optional)", placeholder="E.g. Peshawari")
|
302 |
+
# fabric = st.selectbox("Select your preferred fabric", ["Cotton", "Linen", "Wool", "Polyester", "Silk", "Leather"])
|
303 |
+
|
304 |
+
# # Result display in the right column (col2)
|
305 |
+
# with col2:
|
306 |
+
# if city:
|
307 |
+
# weather_data = get_weather_data(city)
|
308 |
+
|
309 |
+
# if weather_data and weather_data["cod"] == 200:
|
310 |
+
# temperature, description = parse_weather_data(weather_data)
|
311 |
+
# # Categorize the weather
|
312 |
+
# weather_category, weather_icon = categorize_weather(description)
|
313 |
+
|
314 |
+
# # Display current weather info
|
315 |
+
# st.write(f"Current temperature in {city}: {temperature}°C")
|
316 |
+
# st.write(f"Weather: {description} {weather_icon}")
|
317 |
+
# st.write(f"Weather Category: {weather_category} {weather_icon}")
|
318 |
+
|
319 |
+
# # Get outfit suggestion based on user preferences
|
320 |
+
# outfit_suggestion, weather_icon = get_outfit_suggestion(temperature, description, personalized_style, fabric, weather_category, weather_icon)
|
321 |
+
|
322 |
+
# if outfit_suggestion:
|
323 |
+
# # Display outfit suggestion
|
324 |
+
# st.markdown(f"### 🌟 Outfit Suggestion 🌟")
|
325 |
+
# st.write(outfit_suggestion)
|
326 |
+
|
327 |
+
# # Additional section for Health and Comfort Tips
|
328 |
+
# st.markdown(f"### 🌿 Health & Comfort Tips 🌿")
|
329 |
+
# st.write(f"Given the {weather_category} weather, it's important to take care of your health:")
|
330 |
+
# st.write("- **Breathing**: A face mask or scarf covering your nose and mouth can help protect you from smoke inhalation.")
|
331 |
+
# st.write("- **Hydration**: Keep a water bottle with you, as smoke can dehydrate your body.")
|
332 |
+
# st.write("- **Rest**: Try to avoid strenuous activity outdoors and take breaks if you're feeling fatigued.")
|
333 |
+
# st.write("- **Eyes**: If you're feeling irritated, use eye drops to soothe any discomfort caused by smoke.")
|
334 |
+
|
335 |
+
# # Display weather icon
|
336 |
+
# icon_code = weather_data["weather"][0]["icon"]
|
337 |
+
# icon_url = f"http://openweathermap.org/img/wn/{icon_code}.png"
|
338 |
+
# st.image(icon_url)
|
339 |
+
# else:
|
340 |
+
# st.write("Could not retrieve weather data. Please check the location.")
|
341 |
+
|
342 |
+
|
343 |
# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
344 |
|
345 |
|