lopera47 commited on
Commit
ad26642
·
verified ·
1 Parent(s): 437435d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -12,7 +12,7 @@ import pandas as pd
12
  # from langchain_community.chat_models import ChatHuggingFace
13
  # from langchain.llms.base import LLM
14
  # from huggingface_hub import InferenceClient
15
- from smolagents import ToolCallingAgent, DuckDuckGoSearchTool, InferenceClientModel
16
  from smolagents.tools import Tool
17
 
18
  # (Keep Constants as is)
@@ -31,6 +31,7 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
31
  # --- Basic Agent Definition ---
32
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
33
  # --- Excel Reading Tool ---
 
34
  def read_excel_tool(file_path: str) -> str:
35
  try:
36
  if file_path.endswith('.csv'):
@@ -52,12 +53,12 @@ class BasicAgent:
52
  "If a question asks for a count, return only the number."
53
  )
54
 
55
- # Register Excel tool
56
- read_excel = Tool(
57
- name="read_excel",
58
- func=read_excel_tool,
59
- description="Reads Excel or CSV file and returns the first 10 rows as a string."
60
- )
61
 
62
  model = InferenceClientModel(
63
  model_id="gpt-4o",
 
12
  # from langchain_community.chat_models import ChatHuggingFace
13
  # from langchain.llms.base import LLM
14
  # from huggingface_hub import InferenceClient
15
+ from smolagents import ToolCallingAgent, DuckDuckGoSearchTool, InferenceClientModel, tool
16
  from smolagents.tools import Tool
17
 
18
  # (Keep Constants as is)
 
31
  # --- Basic Agent Definition ---
32
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
33
  # --- Excel Reading Tool ---
34
+ @tool
35
  def read_excel_tool(file_path: str) -> str:
36
  try:
37
  if file_path.endswith('.csv'):
 
53
  "If a question asks for a count, return only the number."
54
  )
55
 
56
+ # # Register Excel tool
57
+ # read_excel = Tool(
58
+ # name="read_excel",
59
+ # func=read_excel_tool,
60
+ # description="Reads Excel or CSV file and returns the first 10 rows as a string."
61
+ # )
62
 
63
  model = InferenceClientModel(
64
  model_id="gpt-4o",