umarigan commited on
Commit
e22e735
·
verified ·
1 Parent(s): c79af1e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -20
app.py CHANGED
@@ -4,7 +4,6 @@ import pytz
4
  import yfinance as yf
5
  import os
6
  from Gradio_UI import GradioUI
7
- import gradio as gr
8
 
9
  # Fetch the API key from the environment variable (if needed)
10
  API_KEY = os.getenv("KEY")
@@ -60,25 +59,19 @@ agent = CodeAgent(
60
  verbosity_level=1
61
  )
62
 
63
- # Add a Markdown section for example usage
64
- examples = """
65
- ### Example Usage
66
- 1. **Currency Rate**: Ask for the exchange rate of a currency pair.
67
- - Example: "What is the current exchange rate for USD to JPY?"
68
- - Example: "Get the EUR to GBP rate."
69
 
70
- 2. **Current Time**: Ask for the current time in a specific timezone.
71
- - Example: "What is the current time in America/New_York?"
72
- - Example: "Get the time in Asia/Tokyo."
 
 
73
  """
74
 
75
- # Modify the Gradio UI to include the examples
76
- def launch_with_examples(agent):
77
- with gr.Blocks() as demo:
78
- gr.Markdown("# Currency and Time Agent")
79
- gr.Markdown(examples)
80
- GradioUI(agent).launch() # Use launch() instead of render()
81
- demo.launch()
82
-
83
- # Launch the app
84
- launch_with_examples(agent)
 
4
  import yfinance as yf
5
  import os
6
  from Gradio_UI import GradioUI
 
7
 
8
  # Fetch the API key from the environment variable (if needed)
9
  API_KEY = os.getenv("KEY")
 
59
  verbosity_level=1
60
  )
61
 
62
+ # Add example usage instructions to the Gradio UI description
63
+ description = """
64
+ ### Currency and Time Agent
65
+ This app allows you to:
66
+ 1. Get the current exchange rate for a currency pair (e.g., USD to JPY).
67
+ 2. Get the current time in a specific timezone (e.g., America/New_York).
68
 
69
+ #### Example Queries:
70
+ - "What is the current exchange rate for USD to JPY?"
71
+ - "Get the EUR to GBP rate."
72
+ - "What is the current time in America/New_York?"
73
+ - "Get the time in Asia/Tokyo."
74
  """
75
 
76
+ # Launch the Gradio UI
77
+ GradioUI(agent, description=description).launch()