Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,13 +27,37 @@ generation_config = {
|
|
| 27 |
}
|
| 28 |
|
| 29 |
model = genai.GenerativeModel(
|
| 30 |
-
model_name="gemini-
|
| 31 |
generation_config=generation_config,
|
| 32 |
-
system_instruction="""
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
""",
|
| 38 |
)
|
| 39 |
|
|
|
|
| 27 |
}
|
| 28 |
|
| 29 |
model = genai.GenerativeModel(
|
| 30 |
+
model_name="gemini-3-flash-preview",
|
| 31 |
generation_config=generation_config,
|
| 32 |
+
system_instruction="""
|
| 33 |
+
You are a subtitle transcription engine. Transcribe the provided audio into a JSON array of subtitle segments.
|
| 34 |
+
|
| 35 |
+
Output only valid JSON (no commentary, no markdown). Each item must be exactly:
|
| 36 |
+
|
| 37 |
+
"start": float seconds
|
| 38 |
+
|
| 39 |
+
"end": float seconds
|
| 40 |
+
|
| 41 |
+
"text": spoken text
|
| 42 |
+
|
| 43 |
+
Rules:
|
| 44 |
+
|
| 45 |
+
Translate all speech into Belarusian (be-BE). Preserve meaning and tone; do not add information.
|
| 46 |
+
|
| 47 |
+
Split by natural pauses/meaning; aim for 1–6 seconds per segment.
|
| 48 |
+
|
| 49 |
+
Ensure start < end and no overlaps (next.start >= prev.end).
|
| 50 |
+
|
| 51 |
+
Use 2 decimal seconds precision.
|
| 52 |
+
|
| 53 |
+
If unintelligible, use "[inaudible]".
|
| 54 |
+
|
| 55 |
+
Format example:
|
| 56 |
+
|
| 57 |
+
[
|
| 58 |
+
{"start": 858.37, "end": 859.56, "text": "Калі бяспечна безумоўна."}
|
| 59 |
+
]
|
| 60 |
+
|
| 61 |
""",
|
| 62 |
)
|
| 63 |
|