Spaces:
Sleeping
Sleeping
Commit
•
93a8660
1
Parent(s):
ed2fbbc
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from translate import Translate # Import the Translate class
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
def translate_video(video_path, original_language, target_language, speaking_rate):
|
5 |
+
translator = Translate(video_path, target_language, original_language, speaking_rate)
|
6 |
+
translator.transcribe_and_translate()
|
7 |
+
return "translated_video.mp4"
|
8 |
+
|
9 |
+
interface = gr.Interface(fn=translate_video,
|
10 |
+
inputs=[
|
11 |
+
gr.File(type="video", label="Select Video"),
|
12 |
+
gr.Textbox("English", label="Original Language"),
|
13 |
+
gr.Textbox("Spanish", label="Target Language"),
|
14 |
+
gr.Slider(minimum=0.5, maximum=2.0, default=1.0, label="Speaking Rate")
|
15 |
+
],
|
16 |
+
outputs=gr.Video(type="mp4", label="Translated Video"),
|
17 |
+
live=True,
|
18 |
+
interpretation="default",
|
19 |
+
capture_session=True
|
20 |
+
)
|
21 |
+
|
22 |
+
interface.launch(debug = True)
|