toecm commited on
Commit
e7ed55c
·
verified ·
1 Parent(s): 9cfa5b3

Update src/ux_agent.py

Browse files
Files changed (1) hide show
  1. src/ux_agent.py +9 -2
src/ux_agent.py CHANGED
@@ -390,12 +390,19 @@ class AgentUX:
390
  return "⚠️ Select a dialect first.", gr.update(visible=False), None
391
 
392
  permanent_audio_path = ""
 
393
  if blob:
394
- save_dir = "/app/saved_audio"
395
  os.makedirs(save_dir, exist_ok=True)
396
  unique_name = f"research_{int(time.time())}_{uuid.uuid4().hex[:6]}.wav"
397
  permanent_audio_path = os.path.join(save_dir, unique_name)
398
- shutil.copy(blob, permanent_audio_path)
 
 
 
 
 
 
399
  elif self.last_audio_path:
400
  permanent_audio_path = self.last_audio_path
401
 
 
390
  return "⚠️ Select a dialect first.", gr.update(visible=False), None
391
 
392
  permanent_audio_path = ""
393
+ # 🟢 FIX: Point directly to the IEDID dataset directory
394
  if blob:
395
+ save_dir = os.path.join(self.brain.config.DATASET_DIR, "audio")
396
  os.makedirs(save_dir, exist_ok=True)
397
  unique_name = f"research_{int(time.time())}_{uuid.uuid4().hex[:6]}.wav"
398
  permanent_audio_path = os.path.join(save_dir, unique_name)
399
+
400
+ # Safe copy: Gradio passes filepaths as strings
401
+ if isinstance(blob, str) and os.path.exists(blob):
402
+ shutil.copy(blob, permanent_audio_path)
403
+ else:
404
+ shutil.copy(str(blob), permanent_audio_path)
405
+
406
  elif self.last_audio_path:
407
  permanent_audio_path = self.last_audio_path
408