Srj-ai commited on
Commit
ef10eb7
·
verified ·
1 Parent(s): 0967327

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -18,6 +18,11 @@ final_answer = FinalAnswerTool()
18
  wikipedia_search= WikipediaSearchTool()
19
  python_code_executor=PythonInterpreterTool()
20
 
 
 
 
 
 
21
 
22
  @tool
23
  def describe_image(path: str) -> str:
@@ -25,10 +30,6 @@ def describe_image(path: str) -> str:
25
  Args:
26
  path: Path to the image file to analyze.
27
  """
28
- image_captioner = pipeline(
29
- "image-to-text",
30
- model="Salesforce/blip-image-captioning-base"
31
- )
32
  return image_captioner(path)[0]["generated_text"]
33
 
34
  @tool
@@ -38,16 +39,16 @@ def audio_to_text_tool(audio_file_path:str) -> str:
38
  audio_file_path: path of audio data file
39
  """
40
  output = SpeechToTextTool()
41
- return output
42
 
43
  @tool
44
- def excel_reader(file_path):
45
- """ reads an excel file. Requires the file path as input. Return rows and columns of a data frame.
46
  Args:
47
  file_path: file path as input
48
  """
49
  df= pd.read_excel(file_path)
50
- return (df.rows, df.columns)
51
 
52
  class BasicAgent:
53
  def __init__(self):
 
18
  wikipedia_search= WikipediaSearchTool()
19
  python_code_executor=PythonInterpreterTool()
20
 
21
+ image_captioner = pipeline(
22
+ "image-to-text",
23
+ model="Salesforce/blip-image-captioning-base"
24
+ )
25
+
26
 
27
  @tool
28
  def describe_image(path: str) -> str:
 
30
  Args:
31
  path: Path to the image file to analyze.
32
  """
 
 
 
 
33
  return image_captioner(path)[0]["generated_text"]
34
 
35
  @tool
 
39
  audio_file_path: path of audio data file
40
  """
41
  output = SpeechToTextTool()
42
+ return output(audio_file_path)
43
 
44
  @tool
45
+ def excel_reader(file_path:str) -> str:
46
+ """ reads an excel file. Requires the file path as input. Return information on rows and columns.
47
  Args:
48
  file_path: file path as input
49
  """
50
  df= pd.read_excel(file_path)
51
+ return f"Rows: {len(df)}, Columns: {list(df.columns)}"
52
 
53
  class BasicAgent:
54
  def __init__(self):