Pontonkid commited on
Commit
9ed5287
·
verified ·
1 Parent(s): 63be5d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -8,7 +8,7 @@ client = Client(api_key)
8
  # Function to get current exchange rates
9
  def convert_currency(amount, from_currency, to_currency, historical=False, date=None):
10
  try:
11
- if historical:
12
  # Fetch historical data if needed
13
  result = client.historical(date=date)
14
  rates = result.get('data', {}).get(date, {})
@@ -49,7 +49,7 @@ def create_interface():
49
 
50
  with gr.Row():
51
  historical_checkbox = gr.Checkbox(label="Get Historical Data", value=False)
52
- historical_date = gr.Date(label="Select Date", visible=False)
53
 
54
  with gr.Row():
55
  convert_button = gr.Button("Convert")
@@ -74,3 +74,4 @@ def create_interface():
74
  # Launch the interface
75
  interface = create_interface()
76
  interface.launch(share=True)
 
 
8
  # Function to get current exchange rates
9
  def convert_currency(amount, from_currency, to_currency, historical=False, date=None):
10
  try:
11
+ if historical and date:
12
  # Fetch historical data if needed
13
  result = client.historical(date=date)
14
  rates = result.get('data', {}).get(date, {})
 
49
 
50
  with gr.Row():
51
  historical_checkbox = gr.Checkbox(label="Get Historical Data", value=False)
52
+ historical_date = gr.Textbox(label="Select Date (YYYY-MM-DD)", visible=False) # Use Textbox for date
53
 
54
  with gr.Row():
55
  convert_button = gr.Button("Convert")
 
74
  # Launch the interface
75
  interface = create_interface()
76
  interface.launch(share=True)
77
+