Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,6 +9,9 @@ import json
|
|
| 9 |
import shutil
|
| 10 |
from typing import Optional
|
| 11 |
|
|
|
|
|
|
|
|
|
|
| 12 |
app = FastAPI(title="VoiceClips heavy video processor (Wav2Lip + FFmpeg)")
|
| 13 |
|
| 14 |
class TranslationJob(BaseModel):
|
|
@@ -391,7 +394,7 @@ def run_production_pipeline(job: TranslationJob, gemini_key: str, elevenlabs_key
|
|
| 391 |
with open(extracted_audio_path, "rb") as audio_file:
|
| 392 |
audio_data = base64.b64encode(audio_file.read()).decode("utf-8")
|
| 393 |
|
| 394 |
-
gemini_url = f"https://generativelanguage.googleapis.com/
|
| 395 |
|
| 396 |
if job.has_captions:
|
| 397 |
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."
|
|
|
|
| 9 |
import shutil
|
| 10 |
from typing import Optional
|
| 11 |
|
| 12 |
+
# Google API Kararlı Sürüm Zorlaması (Beta Devri Bitti!)
|
| 13 |
+
os.environ["GEMINI_API_VERSION"] = "v1"
|
| 14 |
+
|
| 15 |
app = FastAPI(title="VoiceClips heavy video processor (Wav2Lip + FFmpeg)")
|
| 16 |
|
| 17 |
class TranslationJob(BaseModel):
|
|
|
|
| 394 |
with open(extracted_audio_path, "rb") as audio_file:
|
| 395 |
audio_data = base64.b64encode(audio_file.read()).decode("utf-8")
|
| 396 |
|
| 397 |
+
gemini_url = f"https://generativelanguage.googleapis.com/v1/models/gemini-2.0-flash:generateContent?key={gemini_key}"
|
| 398 |
|
| 399 |
if job.has_captions:
|
| 400 |
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."
|