Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -104,33 +104,34 @@ def format_timestamp(t):
|
|
104 |
mi = (t - int(t))*1000
|
105 |
return f"{int(hh):02d}:{int(mm):02d}:{int(ss):02d},{int(mi):03d}"
|
106 |
|
107 |
-
def gradio_interface():
|
108 |
-
with gr.Blocks() as demo:
|
109 |
-
|
110 |
-
with gr.Row():
|
111 |
-
|
112 |
-
with gr.Column():
|
113 |
-
|
114 |
-
with gr.Row():
|
115 |
-
url = gr.Textbox(placeholder='Youtube video URL', label='URL')
|
116 |
-
|
117 |
-
with gr.Row():
|
118 |
-
|
119 |
-
model_size = gr.Dropdown(choices=model_size, value='tiny', label="Model")
|
120 |
-
lang = gr.Dropdown(choices=langs, value="None", label="Language (Optional)")
|
121 |
-
format = gr.Dropdown(choices=["None", ".srt"], value="None", label="Timestamps? (Optional)")
|
122 |
-
|
123 |
-
with gr.Row():
|
124 |
-
gr.Markdown("Larger models are more accurate, but slower. For 1min video, it'll take ~30s (tiny), ~1min (base), ~3min (small), ~5min (medium), etc.")
|
125 |
-
transcribe_btn = gr.Button('Transcribe')
|
126 |
-
|
127 |
-
with gr.Column():
|
128 |
-
outputs = gr.Textbox(placeholder='Transcription of the video', label='Transcription')
|
129 |
-
|
130 |
-
transcribe_btn.click(get_transcript, inputs=[url, model_size, lang, format], outputs=outputs)
|
131 |
|
132 |
-
|
133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
|
135 |
-
app = gr.mount_gradio_app(app, io, path=CUSTOM_PATH)
|
136 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|
|
104 |
mi = (t - int(t))*1000
|
105 |
return f"{int(hh):02d}:{int(mm):02d}:{int(ss):02d},{int(mi):03d}"
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
|
108 |
+
with gr.Blocks() as demo:
|
109 |
+
|
110 |
+
with gr.Row():
|
111 |
+
|
112 |
+
with gr.Column():
|
113 |
+
|
114 |
+
with gr.Row():
|
115 |
+
url = gr.Textbox(placeholder='Youtube video URL', label='URL')
|
116 |
+
|
117 |
+
with gr.Row():
|
118 |
+
|
119 |
+
model_size = gr.Dropdown(choices=model_size, value='tiny', label="Model")
|
120 |
+
lang = gr.Dropdown(choices=langs, value="None", label="Language (Optional)")
|
121 |
+
format = gr.Dropdown(choices=["None", ".srt"], value="None", label="Timestamps? (Optional)")
|
122 |
+
|
123 |
+
with gr.Row():
|
124 |
+
gr.Markdown("Larger models are more accurate, but slower. For 1min video, it'll take ~30s (tiny), ~1min (base), ~3min (small), ~5min (medium), etc.")
|
125 |
+
transcribe_btn = gr.Button('Transcribe')
|
126 |
+
|
127 |
+
with gr.Column():
|
128 |
+
outputs = gr.Textbox(placeholder='Transcription of the video', label='Transcription')
|
129 |
+
|
130 |
+
transcribe_btn.click(get_transcript, inputs=[url, model_size, lang, format], outputs=outputs)
|
131 |
+
|
132 |
+
demo.launch(debug=True)
|
133 |
+
|
134 |
+
#io = gr.Interface(gradio_interface)
|
135 |
|
136 |
+
#app = gr.mount_gradio_app(app, io, path=CUSTOM_PATH)
|
137 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|