Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -9,27 +9,51 @@ import azure.cognitiveservices.speech as speechsdk
|
|
9 |
from moviepy.editor import AudioFileClip
|
10 |
from gradio_client import Client
|
11 |
|
12 |
-
def app(video_path,
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
return gr.components.File(translated_file)
|
17 |
|
18 |
-
|
19 |
fn=app,
|
20 |
inputs=[
|
21 |
-
gr.
|
22 |
-
gr.Dropdown(
|
23 |
-
|
24 |
-
),
|
25 |
-
gr.Dropdown(
|
26 |
-
["English", "German", "French" ,"Spanish","Urdu"], label="Targeted Language"
|
27 |
-
)
|
28 |
-
# gr.components.Textbox(label="Enter Float Value")
|
29 |
-
|
30 |
],
|
31 |
-
outputs=
|
32 |
-
# outputs=[gr.components.File(label="Your result")]
|
33 |
)
|
34 |
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
from moviepy.editor import AudioFileClip
|
10 |
from gradio_client import Client
|
11 |
|
12 |
+
def app(video_path,original_language, target_language):
|
13 |
+
translator = Translate(video_path,original_language, target_language)
|
14 |
+
translated_text_file = translator.transcribe_and_translate()
|
15 |
+
return translated_text_file
|
|
|
16 |
|
17 |
+
interface_text_file = gr.Interface(
|
18 |
fn=app,
|
19 |
inputs=[
|
20 |
+
gr.File(label="Upload Text File"),
|
21 |
+
gr.Dropdown(["English", "German", "French", "Spanish"], label="Original Language"),
|
22 |
+
gr.Dropdown(["English", "German", "French", "Spanish", "Urdu"], label="Targeted Language"),
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
],
|
24 |
+
outputs=[gr.File(label="Translated Text File")],
|
|
|
25 |
)
|
26 |
|
27 |
+
interface_text_file.launch(debug=True)
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
# interface = gr.Interface(
|
43 |
+
# fn=app,
|
44 |
+
# inputs=[
|
45 |
+
# gr.components.Video(sources="upload", label="upload video"),
|
46 |
+
# gr.Dropdown(
|
47 |
+
# ["English", "German", "French" ,"Spanish"], label="Original Language"
|
48 |
+
# ),
|
49 |
+
# gr.Dropdown(
|
50 |
+
# ["English", "German", "French" ,"Spanish","Urdu"], label="Targeted Language"
|
51 |
+
# )
|
52 |
+
# # gr.components.Textbox(label="Enter Float Value")
|
53 |
+
|
54 |
+
# ],
|
55 |
+
# outputs=outputs=[gr.components.Textbox(label="your result")]
|
56 |
+
# # outputs=[gr.components.File(label="Your result")]
|
57 |
+
# )
|
58 |
+
|
59 |
+
# interface.launch(debug=True)
|