ciyidogan commited on
Commit
371a017
·
verified ·
1 Parent(s): ccb89a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -19
app.py CHANGED
@@ -487,26 +487,41 @@ def health_check():
487
  }
488
  }
489
 
490
- # ---------------- Terminal Endpoint -----------------
491
- @app.get("/terminal/{command:path}")
492
- async def run_command(command: str):
493
- """Terminal komutları çalıştır"""
494
- try:
495
- result = subprocess.run(
496
- command.split(),
497
- capture_output=True,
498
- text=True,
499
- timeout=30,
500
- cwd="/app"
501
- )
502
- return {
503
- "command": command,
504
- "stdout": result.stdout,
505
- "stderr": result.stderr,
506
- "returncode": result.returncode
 
 
 
 
507
  }
508
- except Exception as e:
509
- return {"error": str(e)}
 
 
 
 
 
 
 
 
 
 
 
510
 
511
  # ---------------- Serve static files ------------------------------------
512
  # UI static files (production build)
 
487
  }
488
  }
489
 
490
+ # ---------------- Test Endpoint -----------------
491
+ @app.get("/debug/test_audio")
492
+ async def debug_test_audio():
493
+ """Son oluşturulan audio dosyalarını test et"""
494
+ import glob
495
+
496
+ # En son oluşturulan dosyaları bul
497
+ raw_files = glob.glob("/tmp/raw_audio_*.wav")
498
+ trimmed_files = glob.glob("/tmp/trimmed_audio_*.wav")
499
+
500
+ results = {}
501
+
502
+ if raw_files:
503
+ latest_raw = max(raw_files, key=os.path.getctime)
504
+ result = subprocess.run([
505
+ 'python', '/app/stt/test_single_wav.py', latest_raw
506
+ ], capture_output=True, text=True, cwd='/app/stt')
507
+ results['raw'] = {
508
+ 'file': latest_raw,
509
+ 'stdout': result.stdout,
510
+ 'stderr': result.stderr
511
  }
512
+
513
+ if trimmed_files:
514
+ latest_trimmed = max(trimmed_files, key=os.path.getctime)
515
+ result = subprocess.run([
516
+ 'python', '/app/stt/test_single_wav.py', latest_trimmed
517
+ ], capture_output=True, text=True, cwd='/app/stt')
518
+ results['trimmed'] = {
519
+ 'file': latest_trimmed,
520
+ 'stdout': result.stdout,
521
+ 'stderr': result.stderr
522
+ }
523
+
524
+ return results
525
 
526
  # ---------------- Serve static files ------------------------------------
527
  # UI static files (production build)