Francesco-A commited on
Commit
df82c2e
·
1 Parent(s): a640175

Fix: agent.py and audio_tools

Browse files
Files changed (2) hide show
  1. app.py +4 -4
  2. tools/audio_tools.py +4 -0
app.py CHANGED
@@ -35,13 +35,13 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
35
  secondary_agent = {"name": "GeminiAgent","agent": GeminiAgent()}
36
 
37
  try:
38
- agent = main_agent["agent"]
39
- agent_type = main_agent["name"]
40
  except Exception as main_agent_error:
41
  print(f"{agent_type} failed to initialize: {main_agent_error}.")
42
  try:
43
- agent = secondary_agent["agent"]
44
- agent_type = secondary_agent["name"]
45
  print(f"Falling back to {agent_type}.")
46
  except Exception as secondary_agent_error:
47
  print(f"{agent_type} failed to initialize: {secondary_agent_error}.")
 
35
  secondary_agent = {"name": "GeminiAgent","agent": GeminiAgent()}
36
 
37
  try:
38
+ agent = BasicAgent()
39
+ agent_type = "BasicAgent"
40
  except Exception as main_agent_error:
41
  print(f"{agent_type} failed to initialize: {main_agent_error}.")
42
  try:
43
+ agent = "GeminiAgent"
44
+ agent_type = GeminiAgent()
45
  print(f"Falling back to {agent_type}.")
46
  except Exception as secondary_agent_error:
47
  print(f"{agent_type} failed to initialize: {secondary_agent_error}.")
tools/audio_tools.py CHANGED
@@ -29,6 +29,10 @@ def youtube_to_text(url: str) -> str:
29
  return text
30
  except Exception:
31
  pass # Silent fallback to Whisper
 
 
 
 
32
 
33
  # ---- Step 2: Fallback to Whisper transcription ----
34
  try:
 
29
  return text
30
  except Exception:
31
  pass # Silent fallback to Whisper
32
+ finally:
33
+ # Cleanup temp file to save space
34
+ if audio_path and os.path.exists(audio_path):
35
+ os.remove(audio_path)
36
 
37
  # ---- Step 2: Fallback to Whisper transcription ----
38
  try: