Update app.py
Browse files
app.py
CHANGED
@@ -56,39 +56,9 @@ class AudioTranscriptionTool(Tool):
|
|
56 |
|
57 |
|
58 |
|
59 |
-
# --- Tool 3: Excel Reader Tool ---
|
60 |
-
import tempfile
|
61 |
-
import base64
|
62 |
-
|
63 |
-
class ExcelReaderTool(Tool):
|
64 |
-
name = "excel_reader"
|
65 |
-
description = "Reads uploaded Excel file and summarizes sheet data."
|
66 |
-
|
67 |
-
inputs = {
|
68 |
-
"excel": {
|
69 |
-
"type": "string", # base64-encoded .xlsx file
|
70 |
-
"description": "Excel file (.xlsx) encoded as base64 string"
|
71 |
-
}
|
72 |
-
}
|
73 |
-
|
74 |
-
output_type = "string"
|
75 |
-
|
76 |
-
def forward(self, excel: str) -> str:
|
77 |
-
try:
|
78 |
-
excel_bytes = base64.b64decode(excel)
|
79 |
-
with tempfile.NamedTemporaryFile(delete=False, suffix=".xlsx") as tmp_file:
|
80 |
-
tmp_file.write(excel_bytes)
|
81 |
-
tmp_path = tmp_file.name
|
82 |
-
|
83 |
-
df = pd.read_excel(tmp_path)
|
84 |
-
os.remove(tmp_path)
|
85 |
-
|
86 |
-
return "Summary statistics:\n" + df.describe(include="all").to_string()
|
87 |
-
except Exception as e:
|
88 |
-
return f"Failed to read Excel file: {str(e)}"
|
89 |
|
90 |
|
91 |
-
excel_tool = ExcelReaderTool()
|
92 |
#wiki_tool = WikipediaTool()
|
93 |
audio_tool = AudioTranscriptionTool()
|
94 |
|
@@ -97,7 +67,7 @@ async def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
97 |
|
98 |
try:
|
99 |
agent = ToolCallingAgent(
|
100 |
-
tools=[search_tool, audio_tool
|
101 |
model=InferenceClientModel(model="deepseek-ai/DeepSeek-V3", provider="together"),
|
102 |
max_steps=15,
|
103 |
verbosity_level=0,
|
|
|
56 |
|
57 |
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
|
61 |
+
#excel_tool = ExcelReaderTool()
|
62 |
#wiki_tool = WikipediaTool()
|
63 |
audio_tool = AudioTranscriptionTool()
|
64 |
|
|
|
67 |
|
68 |
try:
|
69 |
agent = ToolCallingAgent(
|
70 |
+
tools=[search_tool, audio_tool],
|
71 |
model=InferenceClientModel(model="deepseek-ai/DeepSeek-V3", provider="together"),
|
72 |
max_steps=15,
|
73 |
verbosity_level=0,
|