jairo commited on
Commit
869c912
·
1 Parent(s): 3a2c59e

improve theme

Browse files
Files changed (2) hide show
  1. Gradio_UI.py +39 -13
  2. prompts.yaml +4 -3
Gradio_UI.py CHANGED
@@ -300,11 +300,25 @@ class GradioUI:
300
  def launch(self, **kwargs):
301
  import gradio as gr
302
 
303
- with gr.Blocks(fill_height=True) as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
304
  stored_messages = gr.State([])
305
  file_uploads_log = gr.State([])
 
306
  chatbot = gr.Chatbot(
307
- label="Agent",
308
  type="messages",
309
  avatar_images=(
310
  None,
@@ -312,19 +326,31 @@ class GradioUI:
312
  ),
313
  resizeable=True,
314
  scale=1,
 
 
 
315
  )
316
- # If an upload folder is provided, enable the upload feature
317
- if self.file_upload_folder is not None:
318
- upload_file = gr.File(label="Upload a file")
319
- upload_status = gr.Textbox(
320
- label="Upload Status", interactive=False, visible=False
321
- )
322
- upload_file.change(
323
- self.upload_file,
324
- [upload_file, file_uploads_log],
325
- [upload_status, file_uploads_log],
326
  )
327
- text_input = gr.Textbox(lines=1, label="Chat Message")
 
 
 
 
 
 
 
 
 
 
 
328
  text_input.submit(
329
  self.log_user_message,
330
  [text_input, file_uploads_log],
 
300
  def launch(self, **kwargs):
301
  import gradio as gr
302
 
303
+ with gr.Blocks(theme=gr.themes.Soft()) as demo:
304
+ gr.Markdown("""
305
+ # 🤏 📰 SmolNews: News and Time AI Agent
306
+
307
+ I'm here to help you stay updated on the time and news from locations around the world.
308
+
309
+ Ask me things like:
310
+
311
+ * Get the current time anywhere (e.g., "What time is it in `Bogotá`?")
312
+ * Find the latest news from any location (e.g., "What's happening in `Paris`?")
313
+ * Do both at once (e.g., "Tell me the time and news in `Tokyo`")
314
+
315
+ """)
316
+
317
  stored_messages = gr.State([])
318
  file_uploads_log = gr.State([])
319
+
320
  chatbot = gr.Chatbot(
321
+ label="SmolNews: News and Time AI Agent",
322
  type="messages",
323
  avatar_images=(
324
  None,
 
326
  ),
327
  resizeable=True,
328
  scale=1,
329
+ height=600,
330
+ container=True,
331
+ bubble_full_width=False,
332
  )
333
+
334
+ with gr.Row():
335
+ text_input = gr.Textbox(
336
+ lines=1,
337
+ label="Ask about time and news from `anywhere` in the world",
338
+ placeholder="e.g., 'What time is it in Bogotá and what's in the news there?'",
339
+ scale=4,
340
+ submit_btn=False,
 
 
341
  )
342
+
343
+ gr.Examples(
344
+ examples=[
345
+ "What time is it in Bogotá and what's happening there?",
346
+ "Tell me the current time and news in London",
347
+ "What's going on in Sydney right now?",
348
+ "Get me the time and latest headlines from Berlin",
349
+ ],
350
+ inputs=text_input,
351
+ label="Try these examples",
352
+ )
353
+
354
  text_input.submit(
355
  self.log_user_message,
356
  [text_input, file_uploads_log],
prompts.yaml CHANGED
@@ -15,7 +15,7 @@
15
 
16
  Thought: I'll first get the current time in Tokyo's timezone, then fetch recent news about Tokyo.
17
  Code:
18
- ```python
19
  time_info = get_current_time_in_timezone(timezone="Europe/Madrid")
20
  print(time_info)
21
  ```<end_code>
@@ -23,7 +23,7 @@
23
 
24
  Thought: Now I'll get the latest news about Madrid.
25
  Code:
26
- ```python
27
  madrid_news = get_news_from_place(place="Madrid")
28
  print(madrid_news)
29
  ```<end_code>
@@ -31,9 +31,10 @@
31
 
32
  Thought: I will now provide the final answer in a casual style, NO BULLET POINTS, more like a friend talking about the news.
33
  Code:
34
- ```python
35
  final_answer("""It's a new day in Madrid (3:11 AM on Feb 18, 2025) and the city is buzzing. On the pitch, Real Madrid's in the spotlight—with heated VAR debates, a wild red card saga involving Jude Bellingham that could lead to a long ban, and plenty of back-and-forth from top managers like Ancelotti and Guardiola. Off the field, Madrid making moves too—from fresh car-sharing zones and major real estate deals to impactful court rulings. Basically, whether you're into football drama or the city's business buzz, Madrid got it all going on right now.""")
36
  ```<end_code>
 
37
 
38
  You have access to these tools:
39
  - get_current_time_in_timezone: A tool that fetches the current local time in a specified timezone.
 
15
 
16
  Thought: I'll first get the current time in Tokyo's timezone, then fetch recent news about Tokyo.
17
  Code:
18
+ ```py
19
  time_info = get_current_time_in_timezone(timezone="Europe/Madrid")
20
  print(time_info)
21
  ```<end_code>
 
23
 
24
  Thought: Now I'll get the latest news about Madrid.
25
  Code:
26
+ ```py
27
  madrid_news = get_news_from_place(place="Madrid")
28
  print(madrid_news)
29
  ```<end_code>
 
31
 
32
  Thought: I will now provide the final answer in a casual style, NO BULLET POINTS, more like a friend talking about the news.
33
  Code:
34
+ ```py
35
  final_answer("""It's a new day in Madrid (3:11 AM on Feb 18, 2025) and the city is buzzing. On the pitch, Real Madrid's in the spotlight—with heated VAR debates, a wild red card saga involving Jude Bellingham that could lead to a long ban, and plenty of back-and-forth from top managers like Ancelotti and Guardiola. Off the field, Madrid making moves too—from fresh car-sharing zones and major real estate deals to impactful court rulings. Basically, whether you're into football drama or the city's business buzz, Madrid got it all going on right now.""")
36
  ```<end_code>
37
+ ---
38
 
39
  You have access to these tools:
40
  - get_current_time_in_timezone: A tool that fetches the current local time in a specified timezone.