Sonu313131 commited on
Commit
4293685
·
verified ·
1 Parent(s): 0ca3fbf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -15,11 +15,10 @@ login(token=os.environ["HUGGINGFACEHUB_API_TOKEN"])
15
  ## TOOL 1
16
  search_tool = DuckDuckGoSearchTool()
17
 
18
- ## TOOL 2
19
  class WikipediaTool(Tool):
20
  name = "wikipedia_search"
21
  description = "Search Wikipedia for a given topic and return a concise summary."
22
- inputs = {"query": "string"}
23
  output_type = "string"
24
 
25
  def forward(self, query: str) -> str:
@@ -33,11 +32,12 @@ class WikipediaTool(Tool):
33
  except Exception as e:
34
  return f"Error: {str(e)}"
35
 
36
- ## TOOL 3
 
37
  class AudioTranscriptionTool(Tool):
38
  name = "audio_transcriber"
39
  description = "Transcribes an uploaded audio file to text using Whisper."
40
- inputs = {"audio": "audio"}
41
  output_type = "string"
42
 
43
  def forward(self, audio: str) -> str:
@@ -53,11 +53,12 @@ class AudioTranscriptionTool(Tool):
53
  except Exception as e:
54
  return f"Transcription failed: {str(e)}"
55
 
56
- ## TOOL 4
 
57
  class ExcelReaderTool(Tool):
58
  name = "excel_reader"
59
  description = "Reads uploaded Excel file and summarizes sheet data."
60
- inputs = {"excel": "file"}
61
  output_type = "string"
62
 
63
  def forward(self, excel) -> str:
 
15
  ## TOOL 1
16
  search_tool = DuckDuckGoSearchTool()
17
 
 
18
  class WikipediaTool(Tool):
19
  name = "wikipedia_search"
20
  description = "Search Wikipedia for a given topic and return a concise summary."
21
+ inputs = {"query": {"type": "string"}}
22
  output_type = "string"
23
 
24
  def forward(self, query: str) -> str:
 
32
  except Exception as e:
33
  return f"Error: {str(e)}"
34
 
35
+
36
+ # --- Tool 2: Audio Transcription Tool (uses whisper base) ---
37
  class AudioTranscriptionTool(Tool):
38
  name = "audio_transcriber"
39
  description = "Transcribes an uploaded audio file to text using Whisper."
40
+ inputs = {"audio": {"type": "audio"}}
41
  output_type = "string"
42
 
43
  def forward(self, audio: str) -> str:
 
53
  except Exception as e:
54
  return f"Transcription failed: {str(e)}"
55
 
56
+
57
+ # --- Tool 3: Excel Reader Tool ---
58
  class ExcelReaderTool(Tool):
59
  name = "excel_reader"
60
  description = "Reads uploaded Excel file and summarizes sheet data."
61
+ inputs = {"excel": {"type": "file"}}
62
  output_type = "string"
63
 
64
  def forward(self, excel) -> str: