Uncomment transcription in code and transformers into requirements.txt
Browse files- app.py +11 -2
- requirements.txt +3 -0
app.py
CHANGED
@@ -9,6 +9,7 @@ from lang_list import union_language_dict
|
|
9 |
# import pyperclip
|
10 |
from pytube import YouTube
|
11 |
import re
|
|
|
12 |
|
13 |
NUMBER = 100
|
14 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
@@ -444,7 +445,15 @@ def subtify():
|
|
444 |
# Layout
|
445 |
gr.Markdown("""# Subtify""")
|
446 |
gr.Markdown("""download""")
|
447 |
-
gr.Markdown(f"Python {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
with gr.Row(variant="panel"):
|
449 |
url_textbox = gr.Textbox(placeholder="Add video URL here", label="Video URL", elem_id="video_url", scale=1, interactive=True)
|
450 |
copy_button = gr.Button(size="sm", icon="icons/copy.svg", value="", min_width="10px", scale=0)
|
@@ -501,7 +510,7 @@ def subtify():
|
|
501 |
]
|
502 |
)
|
503 |
subtify_button.click(fn=get_audio_and_video_from_video, inputs=[url_textbox, stream_page], outputs=[original_audio, original_audio_path, original_video_path])
|
504 |
-
|
505 |
# original_audio_transcribed.change(fn=translate_transcription, inputs=[original_audio_transcribed_path, source_languaje, target_languaje], outputs=[original_audio_translated, original_audio_translated_path])
|
506 |
# original_audio_translated.change(fn=add_translated_subtitles_to_video, inputs=[original_video_path, original_audio_path, original_audio_translated_path], outputs=subtitled_video)
|
507 |
|
|
|
9 |
# import pyperclip
|
10 |
from pytube import YouTube
|
11 |
import re
|
12 |
+
import transformers
|
13 |
|
14 |
NUMBER = 100
|
15 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
445 |
# Layout
|
446 |
gr.Markdown("""# Subtify""")
|
447 |
gr.Markdown("""download""")
|
448 |
+
gr.Markdown(f"Python: {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}")
|
449 |
+
# model = transformers.AutoModel.from_pretrained("huggingface/my_model")
|
450 |
+
# gr.Markdown(f"model.config.url: {model.config.url}")
|
451 |
+
token = os.getenv("HF_TOKEN")
|
452 |
+
if token is not None:
|
453 |
+
print(token)
|
454 |
+
gr.Markdown(f"Huggingface token: {token}")
|
455 |
+
else:
|
456 |
+
gr.Markdown(f"Huggingface token: None")
|
457 |
with gr.Row(variant="panel"):
|
458 |
url_textbox = gr.Textbox(placeholder="Add video URL here", label="Video URL", elem_id="video_url", scale=1, interactive=True)
|
459 |
copy_button = gr.Button(size="sm", icon="icons/copy.svg", value="", min_width="10px", scale=0)
|
|
|
510 |
]
|
511 |
)
|
512 |
subtify_button.click(fn=get_audio_and_video_from_video, inputs=[url_textbox, stream_page], outputs=[original_audio, original_audio_path, original_video_path])
|
513 |
+
original_audio.change(fn=trascribe_audio, inputs=[original_audio_path, source_languaje], outputs=[original_audio_transcribed, original_audio_transcribed_path])
|
514 |
# original_audio_transcribed.change(fn=translate_transcription, inputs=[original_audio_transcribed_path, source_languaje, target_languaje], outputs=[original_audio_translated, original_audio_translated_path])
|
515 |
# original_audio_translated.change(fn=add_translated_subtitles_to_video, inputs=[original_video_path, original_audio_path, original_audio_translated_path], outputs=subtitled_video)
|
516 |
|
requirements.txt
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
# gradio
|
2 |
gradio
|
3 |
|
|
|
|
|
|
|
4 |
# Download youtube and twitch videos
|
5 |
pytube
|
6 |
yt-dlp
|
|
|
1 |
# gradio
|
2 |
gradio
|
3 |
|
4 |
+
# Get environment
|
5 |
+
transformers
|
6 |
+
|
7 |
# Download youtube and twitch videos
|
8 |
pytube
|
9 |
yt-dlp
|