Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
from typing import Iterator
|
2 |
-
|
3 |
from io import StringIO
|
4 |
import os
|
5 |
import pathlib
|
@@ -17,7 +17,7 @@ from src.utils import slugify, write_srt, write_vtt
|
|
17 |
from src.vad import NonSpeechStrategy, PeriodicTranscriptionConfig, TranscriptionConfig, VadPeriodicTranscription, VadSileroTranscription
|
18 |
|
19 |
# Limitations (set to -1 to disable)
|
20 |
-
DEFAULT_INPUT_AUDIO_MAX_DURATION =
|
21 |
|
22 |
# Whether or not to automatically delete all uploaded files, to save disk space
|
23 |
DELETE_UPLOADED_FILES = True
|
@@ -221,10 +221,11 @@ def create_ui(inputAudioMaxDuration, share=False, server_name: str = None):
|
|
221 |
ui_article = "Read the [documentation here](https://huggingface.co/spaces/aadnk/whisper-webui/blob/main/docs/options.md)"
|
222 |
|
223 |
demo = gr.Interface(fn=ui.transcribe_webui, description=ui_description, article=ui_article, inputs=[
|
224 |
-
gr.Dropdown(choices=["
|
225 |
gr.Dropdown(choices=sorted(LANGUAGES), label="Language"),
|
226 |
gr.Text(label="URL (YouTube, etc.)"),
|
227 |
-
gr.Audio(source="upload", type="filepath", label="Upload Audio"),
|
|
|
228 |
gr.Audio(source="microphone", type="filepath", label="Microphone Input"),
|
229 |
gr.Dropdown(choices=["transcribe", "translate"], label="Task"),
|
230 |
gr.Dropdown(choices=["none", "silero-vad", "silero-vad-skip-gaps", "silero-vad-expand-into-gaps", "periodic-vad"], label="VAD"),
|
@@ -236,21 +237,11 @@ def create_ui(inputAudioMaxDuration, share=False, server_name: str = None):
|
|
236 |
gr.File(label="Download"),
|
237 |
gr.Text(label="Transcription"),
|
238 |
gr.Text(label="Segments")
|
|
|
239 |
])
|
240 |
|
241 |
demo.launch(share=share, server_name=server_name)
|
242 |
|
243 |
if __name__ == '__main__':
|
244 |
-
|
245 |
-
if uploaded_file is not None:
|
246 |
-
# To read file as bytes:
|
247 |
-
bytes_data = uploaded_file.getvalue()
|
248 |
-
st.video(bytes_data)
|
249 |
-
os.system("rm -R /tmp/*")
|
250 |
-
os.system("mkdir /tmp/_input")
|
251 |
-
os.system("mkdir /tmp/_output")
|
252 |
-
os.system("mkdir /tmp/_outputf")
|
253 |
-
os.system("mkdir /tmp/videoSaida")
|
254 |
-
with open("/tmp/inputvideo", "wb") as binary_file:
|
255 |
-
binary_file.write(bytes_data)
|
256 |
create_ui(DEFAULT_INPUT_AUDIO_MAX_DURATION)
|
|
|
1 |
from typing import Iterator
|
2 |
+
|
3 |
from io import StringIO
|
4 |
import os
|
5 |
import pathlib
|
|
|
17 |
from src.vad import NonSpeechStrategy, PeriodicTranscriptionConfig, TranscriptionConfig, VadPeriodicTranscription, VadSileroTranscription
|
18 |
|
19 |
# Limitations (set to -1 to disable)
|
20 |
+
DEFAULT_INPUT_AUDIO_MAX_DURATION = 1200 # seconds
|
21 |
|
22 |
# Whether or not to automatically delete all uploaded files, to save disk space
|
23 |
DELETE_UPLOADED_FILES = True
|
|
|
221 |
ui_article = "Read the [documentation here](https://huggingface.co/spaces/aadnk/whisper-webui/blob/main/docs/options.md)"
|
222 |
|
223 |
demo = gr.Interface(fn=ui.transcribe_webui, description=ui_description, article=ui_article, inputs=[
|
224 |
+
gr.Dropdown(choices=["medium.en", "large"], value="medium.en", label="Model"),
|
225 |
gr.Dropdown(choices=sorted(LANGUAGES), label="Language"),
|
226 |
gr.Text(label="URL (YouTube, etc.)"),
|
227 |
+
gr.Audio(source="upload", type="filepath", label="Upload Audio"),
|
228 |
+
gr.File(label="submeta seu video",interactive=True)
|
229 |
gr.Audio(source="microphone", type="filepath", label="Microphone Input"),
|
230 |
gr.Dropdown(choices=["transcribe", "translate"], label="Task"),
|
231 |
gr.Dropdown(choices=["none", "silero-vad", "silero-vad-skip-gaps", "silero-vad-expand-into-gaps", "periodic-vad"], label="VAD"),
|
|
|
237 |
gr.File(label="Download"),
|
238 |
gr.Text(label="Transcription"),
|
239 |
gr.Text(label="Segments")
|
240 |
+
gr.Text(label="Videos")
|
241 |
])
|
242 |
|
243 |
demo.launch(share=share, server_name=server_name)
|
244 |
|
245 |
if __name__ == '__main__':
|
246 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
create_ui(DEFAULT_INPUT_AUDIO_MAX_DURATION)
|