habulaj commited on
Commit
513121f
·
verified ·
1 Parent(s): 549373f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -815,6 +815,10 @@ async def generate_subtitle(
815
  # 2. Traduzir com Gemini
816
  log(f"🧠 [Fase 2] Enviando para Gemini ({requested_model}) para tradução PT-BR...")
817
 
 
 
 
 
818
  prompt = f"""Task: Translate the following SRT subtitles to Brazilian Portuguese (PT-BR).
819
 
820
  CRITICAL RULES:
@@ -822,7 +826,7 @@ CRITICAL RULES:
822
  2. **FORMATTING**: Do NOT change the line breaks or the number of lines. Keep the exact visual structure of the original SRT.
823
  3. **CONTEXT**: Translate naturally for a Brazilian audience.
824
  4. **PUNCTUATION**: Adjust punctuation to fit the context best (add question marks, exclamation marks, or periods where semantically appropriate).
825
- 5. **OUTPUT**: Return ONLY the translated SRT content. No extra text.
826
 
827
  ORIGINAL SRT:
828
  {srt_base}
 
815
  # 2. Traduzir com Gemini
816
  log(f"🧠 [Fase 2] Enviando para Gemini ({requested_model}) para tradução PT-BR...")
817
 
818
+ context_instruction = ""
819
+ if context:
820
+ context_instruction = f"\n6. **USER INSTRUCTIONS**: {context}\n"
821
+
822
  prompt = f"""Task: Translate the following SRT subtitles to Brazilian Portuguese (PT-BR).
823
 
824
  CRITICAL RULES:
 
826
  2. **FORMATTING**: Do NOT change the line breaks or the number of lines. Keep the exact visual structure of the original SRT.
827
  3. **CONTEXT**: Translate naturally for a Brazilian audience.
828
  4. **PUNCTUATION**: Adjust punctuation to fit the context best (add question marks, exclamation marks, or periods where semantically appropriate).
829
+ 5. **OUTPUT**: Return ONLY the translated SRT content. No extra text.{context_instruction}
830
 
831
  ORIGINAL SRT:
832
  {srt_base}