Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -164,6 +164,7 @@ def format_attraction_card(name, details):
|
|
164 |
"""
|
165 |
|
166 |
|
|
|
167 |
# CSS
|
168 |
custom_css = """
|
169 |
body, .gradio-container {
|
@@ -188,6 +189,13 @@ body, .gradio-container {
|
|
188 |
font-weight: 600;
|
189 |
text-align: center;
|
190 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
.content-box {
|
192 |
background-color: #ffffff;
|
193 |
border-radius: 0 0 16px 16px;
|
@@ -238,21 +246,6 @@ body, .gradio-container {
|
|
238 |
}
|
239 |
"""
|
240 |
|
241 |
-
# Generate attractions cards
|
242 |
-
def generate_attraction_cards(city):
|
243 |
-
weather = get_weather(city)
|
244 |
-
if not weather:
|
245 |
-
return "<div style='padding:20px; color:red;'>β οΈ Couldn't fetch attractions due to missing weather data.</div>"
|
246 |
-
|
247 |
-
attractions = get_attractions(
|
248 |
-
city=weather["city"],
|
249 |
-
country=weather["country"],
|
250 |
-
temp=weather["temperature"],
|
251 |
-
weather_desc=weather["description"]
|
252 |
-
)
|
253 |
-
return "<div class='card-grid'>" + "".join(format_attraction_card(name, details) for name, details in attractions) + "</div>"
|
254 |
-
|
255 |
-
|
256 |
# UI
|
257 |
def launch_ui():
|
258 |
with gr.Blocks(css=custom_css, title="Travel Weather Guide") as demo:
|
@@ -263,6 +256,7 @@ def launch_ui():
|
|
263 |
# Weather section
|
264 |
with gr.Column(scale=1):
|
265 |
gr.Markdown("<div class='section-header'>π€οΈ Weather Dashboard</div>")
|
|
|
266 |
with gr.Group(elem_classes="content-box"):
|
267 |
city_input = gr.Textbox(label="ποΈ City Name", value="Dubai")
|
268 |
update_btn = gr.Button("π Get Weather Data")
|
@@ -271,6 +265,7 @@ def launch_ui():
|
|
271 |
# Chatbot section
|
272 |
with gr.Column(scale=1):
|
273 |
gr.Markdown("<div class='section-header'>βοΈ Travel Assistant</div>")
|
|
|
274 |
with gr.Group(elem_classes="content-box"):
|
275 |
chat = gr.Chatbot(height=350, type="messages")
|
276 |
with gr.Row():
|
@@ -280,6 +275,7 @@ def launch_ui():
|
|
280 |
|
281 |
# Attractions section
|
282 |
gr.Markdown("<div class='section-header'>ποΈ Top Attractions You Can Visit</div>")
|
|
|
283 |
attractions_html = gr.HTML()
|
284 |
|
285 |
# FOOTER
|
@@ -301,5 +297,3 @@ def launch_ui():
|
|
301 |
demo.load(fn=lambda: update_all("Dubai"), inputs=None, outputs=[weather_html, attractions_html])
|
302 |
|
303 |
demo.launch()
|
304 |
-
|
305 |
-
launch_ui()
|
|
|
164 |
"""
|
165 |
|
166 |
|
167 |
+
# CSS
|
168 |
# CSS
|
169 |
custom_css = """
|
170 |
body, .gradio-container {
|
|
|
189 |
font-weight: 600;
|
190 |
text-align: center;
|
191 |
}
|
192 |
+
.section-subheading {
|
193 |
+
text-align: center;
|
194 |
+
font-size: 0.95rem;
|
195 |
+
color: #444;
|
196 |
+
margin: 10px 0 15px 0;
|
197 |
+
font-style: italic;
|
198 |
+
}
|
199 |
.content-box {
|
200 |
background-color: #ffffff;
|
201 |
border-radius: 0 0 16px 16px;
|
|
|
246 |
}
|
247 |
"""
|
248 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
# UI
|
250 |
def launch_ui():
|
251 |
with gr.Blocks(css=custom_css, title="Travel Weather Guide") as demo:
|
|
|
256 |
# Weather section
|
257 |
with gr.Column(scale=1):
|
258 |
gr.Markdown("<div class='section-header'>π€οΈ Weather Dashboard</div>")
|
259 |
+
gr.Markdown("<div class='section-subheading'>Check current weather details</div>")
|
260 |
with gr.Group(elem_classes="content-box"):
|
261 |
city_input = gr.Textbox(label="ποΈ City Name", value="Dubai")
|
262 |
update_btn = gr.Button("π Get Weather Data")
|
|
|
265 |
# Chatbot section
|
266 |
with gr.Column(scale=1):
|
267 |
gr.Markdown("<div class='section-header'>βοΈ Travel Assistant</div>")
|
268 |
+
gr.Markdown("<div class='section-subheading'>Ask for travel tips and suggestions</div>")
|
269 |
with gr.Group(elem_classes="content-box"):
|
270 |
chat = gr.Chatbot(height=350, type="messages")
|
271 |
with gr.Row():
|
|
|
275 |
|
276 |
# Attractions section
|
277 |
gr.Markdown("<div class='section-header'>ποΈ Top Attractions You Can Visit</div>")
|
278 |
+
gr.Markdown("<div class='section-subheading'>Plan your trip with these recommendations</div>")
|
279 |
attractions_html = gr.HTML()
|
280 |
|
281 |
# FOOTER
|
|
|
297 |
demo.load(fn=lambda: update_all("Dubai"), inputs=None, outputs=[weather_html, attractions_html])
|
298 |
|
299 |
demo.launch()
|
|
|
|