skurtis commited on
Commit
5fb7a53
·
verified ·
1 Parent(s): 93e57c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -17
app.py CHANGED
@@ -8,32 +8,31 @@ from Gradio_UI import GradioUI
8
 
9
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
10
  @tool
11
- def pull_rates(english_fred_id: str)-> str: #it's import to specify the return type
12
  #Keep this format for the description / args / args description but feel free to modify the tool
13
  """A tool that fetches the latest interest or treasury rate from FRED.
14
  Args:
15
- english_fred_id: a string representing a valid insterst rate code to pull from the FRED website
16
  """
17
 
18
  # Dictionary mapping user-friendly tenors to their FRED IDs.
19
- yield_curve_ids = {
20
- "SOFR": "SOFR",
21
- "1 Month": "DGS1MO",
22
- "3 Month": "DGS3MO",
23
- "6 Month": "DGS6MO",
24
- "1 Year": "DGS1",
25
- "2 Year": "DGS2",
26
- "3 Year": "DGS3",
27
- "5 Year": "DGS5",
28
- "7 Year": "DGS7",
29
- "10 Year": "DGS10",
30
- "20 Year": "DGS20",
31
- "30 Year": "DGS30"}
32
 
33
- fred_id = yield_curve_ids[english_fred_id]
34
-
35
  # Build the URL for the CSV on the FRED website
36
  fred_api_url = f"https://fred.stlouisfed.org/graph/fredgraph.csv?id={fred_id}"
 
37
  try:
38
  import pandas as pd
39
  # Create timezone object
 
8
 
9
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
10
  @tool
11
+ def pull_rates(fred_id: str)-> str: #it's import to specify the return type
12
  #Keep this format for the description / args / args description but feel free to modify the tool
13
  """A tool that fetches the latest interest or treasury rate from FRED.
14
  Args:
15
+ fred_id: a string representing a valid insterst rate code to pull from the FRED website
16
  """
17
 
18
  # Dictionary mapping user-friendly tenors to their FRED IDs.
19
+ yield_curve_ids = {'SOFR': 'SOFR',
20
+ 'DGS1MO': '1 Month',
21
+ 'DGS3MO': '3 Month',
22
+ 'DGS6MO': '6 Month',
23
+ 'DGS1': '1 Year',
24
+ 'DGS2': '2 Year',
25
+ 'DGS3': '3 Year',
26
+ 'DGS5': '5 Year',
27
+ 'DGS7': '7 Year',
28
+ 'DGS10': '10 Year',
29
+ 'DGS20': '20 Year',
30
+ 'DGS30': '30 Year'}
 
31
 
32
+ english_fred_id = yield_curve_ids[fred_id]
 
33
  # Build the URL for the CSV on the FRED website
34
  fred_api_url = f"https://fred.stlouisfed.org/graph/fredgraph.csv?id={fred_id}"
35
+
36
  try:
37
  import pandas as pd
38
  # Create timezone object