Update app.py
Browse files
app.py
CHANGED
@@ -5,8 +5,15 @@ import pytz
|
|
5 |
import yaml
|
6 |
from tools.final_answer import FinalAnswerTool
|
7 |
|
|
|
|
|
|
|
|
|
|
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
|
|
|
|
10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
11 |
@tool
|
12 |
def count_instances_of_a_word_in_fed_minutes(pdf_url:str, word:str)-> str:
|
@@ -17,6 +24,7 @@ def count_instances_of_a_word_in_fed_minutes(pdf_url:str, word:str)-> str:
|
|
17 |
arg1: the url where you can find the pdf file for the fed minutes
|
18 |
arg2: the word to count
|
19 |
"""
|
|
|
20 |
# Download the PDF file from the URL
|
21 |
response = requests.get(pdf_url)
|
22 |
response.raise_for_status()
|
@@ -72,7 +80,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
72 |
|
73 |
agent = CodeAgent(
|
74 |
model=model,
|
75 |
-
tools=[final_answer,
|
76 |
max_steps=6,
|
77 |
verbosity_level=1,
|
78 |
grammar=None,
|
|
|
5 |
import yaml
|
6 |
from tools.final_answer import FinalAnswerTool
|
7 |
|
8 |
+
import PyPDF2
|
9 |
+
import requests
|
10 |
+
from transformers import pipeline
|
11 |
+
from io import BytesIO
|
12 |
+
|
13 |
from Gradio_UI import GradioUI
|
14 |
|
15 |
+
# Define inputs
|
16 |
+
|
17 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
18 |
@tool
|
19 |
def count_instances_of_a_word_in_fed_minutes(pdf_url:str, word:str)-> str:
|
|
|
24 |
arg1: the url where you can find the pdf file for the fed minutes
|
25 |
arg2: the word to count
|
26 |
"""
|
27 |
+
|
28 |
# Download the PDF file from the URL
|
29 |
response = requests.get(pdf_url)
|
30 |
response.raise_for_status()
|
|
|
80 |
|
81 |
agent = CodeAgent(
|
82 |
model=model,
|
83 |
+
tools=[final_answer, get_current_time_in_timezone], ## add your tools here (don't remove final answer)
|
84 |
max_steps=6,
|
85 |
verbosity_level=1,
|
86 |
grammar=None,
|