Update app.py
Browse files
app.py
CHANGED
@@ -18,9 +18,6 @@ def update_target_lang(selected_src):
|
|
18 |
|
19 |
def ui1():
|
20 |
with gr.Blocks() as demo:
|
21 |
-
# gr.Markdown("<center><h1 style='font-size: 32px;'>π¬ Auto Subtitle Generator</h1></center>")
|
22 |
-
# gr.Markdown("**Note**: If you have a large video, upload the audio instead, it's much faster to upload.")
|
23 |
-
|
24 |
gr.HTML("""
|
25 |
<div style="text-align: center; margin: 20px auto; max-width: 800px;">
|
26 |
<h1 style="font-size: 2.5em; margin-bottom: 10px;">π¬ Auto Subtitle Generator</h1>
|
@@ -28,6 +25,7 @@ def ui1():
|
|
28 |
<a href="https://github.com/NeuralFalconYT/Auto-Subtitle-Generator-Free" target="_blank" style="display: inline-block; padding: 10px 20px; background-color: #4285F4; color: white; border-radius: 6px; text-decoration: none; font-size: 1em;">π Run on Google Colab</a>
|
29 |
</div>
|
30 |
""")
|
|
|
31 |
with gr.Row():
|
32 |
with gr.Column():
|
33 |
upload_media = gr.File(label="Upload Audio or Video File")
|
@@ -45,12 +43,14 @@ def ui1():
|
|
45 |
translated_srt = gr.File(label="π Translated Subtitles")
|
46 |
shorts_srt = gr.File(label="π± Shorts/Reels Subtitles")
|
47 |
transcript_txt = gr.File(label="π Full Transcript (Text File)")
|
48 |
-
|
|
|
|
|
49 |
|
50 |
generate_btn.click(
|
51 |
fn=subtitle_maker,
|
52 |
inputs=[upload_media, input_lang, output_lang],
|
53 |
-
outputs=[default_srt, translated_srt, customized_srt, word_level_srt, shorts_srt, transcript_txt, transcript_box]
|
54 |
)
|
55 |
|
56 |
input_lang.change(
|
@@ -109,7 +109,7 @@ def prompt_fix_grammar(language="English"):
|
|
109 |
"""
|
110 |
prompt = f"""
|
111 |
-------------- You are a professional subtitle editor for **video dubbing**.
|
112 |
-
Fix the grammar, spelling, and awkward phrasing in the following `.srt` subtitle file while preserving timing, meaning, and emotional tone.
|
113 |
Do NOT translate β keep everything in {language}.
|
114 |
|
115 |
Output in JSON format exactly like this:
|
@@ -248,6 +248,7 @@ def ui2():
|
|
248 |
label="Copy & Paste this prompt in https://aistudio.google.com/",
|
249 |
lines=20,
|
250 |
show_copy_button=True
|
|
|
251 |
)
|
252 |
|
253 |
with gr.Column():
|
|
|
18 |
|
19 |
def ui1():
|
20 |
with gr.Blocks() as demo:
|
|
|
|
|
|
|
21 |
gr.HTML("""
|
22 |
<div style="text-align: center; margin: 20px auto; max-width: 800px;">
|
23 |
<h1 style="font-size: 2.5em; margin-bottom: 10px;">π¬ Auto Subtitle Generator</h1>
|
|
|
25 |
<a href="https://github.com/NeuralFalconYT/Auto-Subtitle-Generator-Free" target="_blank" style="display: inline-block; padding: 10px 20px; background-color: #4285F4; color: white; border-radius: 6px; text-decoration: none; font-size: 1em;">π Run on Google Colab</a>
|
26 |
</div>
|
27 |
""")
|
28 |
+
|
29 |
with gr.Row():
|
30 |
with gr.Column():
|
31 |
upload_media = gr.File(label="Upload Audio or Video File")
|
|
|
43 |
translated_srt = gr.File(label="π Translated Subtitles")
|
44 |
shorts_srt = gr.File(label="π± Shorts/Reels Subtitles")
|
45 |
transcript_txt = gr.File(label="π Full Transcript (Text File)")
|
46 |
+
subtitle_json= gr.File(label="π Full Transcript (JSON File) To make .ass file")
|
47 |
+
word_json= gr.File(label="π Shorts Transcript (JSON File) To make .ass file")
|
48 |
+
transcript_box = gr.Textbox(label="ποΈ Transcript Preview", lines=4,show_copy_button=True)
|
49 |
|
50 |
generate_btn.click(
|
51 |
fn=subtitle_maker,
|
52 |
inputs=[upload_media, input_lang, output_lang],
|
53 |
+
outputs=[default_srt, translated_srt, customized_srt, word_level_srt, shorts_srt, transcript_txt, subtitle_json,word_json,transcript_box]
|
54 |
)
|
55 |
|
56 |
input_lang.change(
|
|
|
109 |
"""
|
110 |
prompt = f"""
|
111 |
-------------- You are a professional subtitle editor for **video dubbing**.
|
112 |
+
Fix the grammar, spelling, and awkward phrasing in the following `.srt` subtitle file while preserving timing, meaning, and emotional tone. Β
|
113 |
Do NOT translate β keep everything in {language}.
|
114 |
|
115 |
Output in JSON format exactly like this:
|
|
|
248 |
label="Copy & Paste this prompt in https://aistudio.google.com/",
|
249 |
lines=20,
|
250 |
show_copy_button=True
|
251 |
+
|
252 |
)
|
253 |
|
254 |
with gr.Column():
|