Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -307,7 +307,7 @@ def run_simulation_pipeline(job: TranslationJob, supabase_url: str, supabase_ano
|
|
| 307 |
time.sleep(2)
|
| 308 |
|
| 309 |
# Step 2: Simulate Gemini Translation
|
| 310 |
-
print(f"[{video_id}] Step 2: Simulating Gemini 2.
|
| 311 |
update_db_status(video_id, user_token, "processing", supabase_url=supabase_url, supabase_anon_key=supabase_anon_key) # Just refresh database connection
|
| 312 |
time.sleep(3)
|
| 313 |
|
|
@@ -390,13 +390,13 @@ def run_production_pipeline(job: TranslationJob, gemini_key: str, elevenlabs_key
|
|
| 390 |
]
|
| 391 |
subprocess.run(cmd_extract, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
| 392 |
|
| 393 |
-
# 3. Request Transcription & Translation from Gemini 2.
|
| 394 |
-
print(f"[{video_id}] Calling Gemini 2.
|
| 395 |
with open(extracted_audio_path, "rb") as audio_file:
|
| 396 |
audio_data = base64.b64encode(audio_file.read()).decode("utf-8")
|
| 397 |
|
| 398 |
# 🎯 DÜZELTME 3: Endpoint URL'i v1beta olarak bırakıldı, faturalı bakiye ile limitsiz akacak!
|
| 399 |
-
gemini_url = f"https://generativelanguage.googleapis.com/v1beta/models/gemini-2.
|
| 400 |
|
| 401 |
if job.has_captions:
|
| 402 |
gemini_prompt = f"Transcribe the following audio, translate it accurately to '{job.target_lang}', and output the result in SRT subtitle format. Keep each caption line short (max 4-5 words) and ensure the timing is aligned with the audio. Output ONLY the raw SRT text, no extra markdown formatting, tags, or explanations."
|
|
|
|
| 307 |
time.sleep(2)
|
| 308 |
|
| 309 |
# Step 2: Simulate Gemini Translation
|
| 310 |
+
print(f"[{video_id}] Step 2: Simulating Gemini 2.5 Flash transcription & translation...")
|
| 311 |
update_db_status(video_id, user_token, "processing", supabase_url=supabase_url, supabase_anon_key=supabase_anon_key) # Just refresh database connection
|
| 312 |
time.sleep(3)
|
| 313 |
|
|
|
|
| 390 |
]
|
| 391 |
subprocess.run(cmd_extract, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
| 392 |
|
| 393 |
+
# 3. Request Transcription & Translation from Gemini 2.5 Flash
|
| 394 |
+
print(f"[{video_id}] Calling Gemini 2.5 Flash for transcription/translation to '{job.target_lang}'...")
|
| 395 |
with open(extracted_audio_path, "rb") as audio_file:
|
| 396 |
audio_data = base64.b64encode(audio_file.read()).decode("utf-8")
|
| 397 |
|
| 398 |
# 🎯 DÜZELTME 3: Endpoint URL'i v1beta olarak bırakıldı, faturalı bakiye ile limitsiz akacak!
|
| 399 |
+
gemini_url = f"https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent?key={gemini_key}"
|
| 400 |
|
| 401 |
if job.has_captions:
|
| 402 |
gemini_prompt = f"Transcribe the following audio, translate it accurately to '{job.target_lang}', and output the result in SRT subtitle format. Keep each caption line short (max 4-5 words) and ensure the timing is aligned with the audio. Output ONLY the raw SRT text, no extra markdown formatting, tags, or explanations."
|