Spaces:
Runtime error
Runtime error
fix state
Browse files
app.py
CHANGED
@@ -83,7 +83,7 @@ async def speech_to_text(video_in):
|
|
83 |
|
84 |
words = [(word['word'], '+' if word['state'] else '-')
|
85 |
for word in timestamps_var]
|
86 |
-
return (words,
|
87 |
except Exception as e:
|
88 |
raise RuntimeError("Error Running inference with local model", e)
|
89 |
|
@@ -120,8 +120,7 @@ async def cut_timestamps_to_video(video_in, timestamps_var):
|
|
120 |
|
121 |
|
122 |
with gr.Blocks() as demo:
|
123 |
-
|
124 |
-
timestamps_var = gr.State()
|
125 |
with gr.Row():
|
126 |
with gr.Column():
|
127 |
gr.Markdown("""
|
@@ -156,8 +155,7 @@ with gr.Blocks() as demo:
|
|
156 |
"./examples/zuckyuval.mp4",
|
157 |
"./examples/cooking.mp4"],
|
158 |
inputs=[file_upload],
|
159 |
-
outputs=[text_in,
|
160 |
-
timestamps_var, video_preview],
|
161 |
cache_examples=True)
|
162 |
|
163 |
with gr.Row():
|
@@ -190,7 +188,7 @@ with gr.Blocks() as demo:
|
|
190 |
return timestamps_var, words
|
191 |
|
192 |
file_upload.upload(speech_to_text, inputs=[file_upload], outputs=[
|
193 |
-
text_in,
|
194 |
select_all_words.click(words_selection, inputs=[timestamps_var], outputs=[
|
195 |
timestamps_var, text_in], queue=False, show_progress=False)
|
196 |
reset_words.click(lambda x: words_selection(x, True), inputs=[timestamps_var], outputs=[
|
|
|
83 |
|
84 |
words = [(word['word'], '+' if word['state'] else '-')
|
85 |
for word in timestamps_var]
|
86 |
+
return (words, timestamps_var, video_in.name)
|
87 |
except Exception as e:
|
88 |
raise RuntimeError("Error Running inference with local model", e)
|
89 |
|
|
|
120 |
|
121 |
|
122 |
with gr.Blocks() as demo:
|
123 |
+
timestamps_var = gr.JSON(visible=False)
|
|
|
124 |
with gr.Row():
|
125 |
with gr.Column():
|
126 |
gr.Markdown("""
|
|
|
155 |
"./examples/zuckyuval.mp4",
|
156 |
"./examples/cooking.mp4"],
|
157 |
inputs=[file_upload],
|
158 |
+
outputs=[text_in, timestamps_var, video_preview],
|
|
|
159 |
cache_examples=True)
|
160 |
|
161 |
with gr.Row():
|
|
|
188 |
return timestamps_var, words
|
189 |
|
190 |
file_upload.upload(speech_to_text, inputs=[file_upload], outputs=[
|
191 |
+
text_in, timestamps_var, video_preview])
|
192 |
select_all_words.click(words_selection, inputs=[timestamps_var], outputs=[
|
193 |
timestamps_var, text_in], queue=False, show_progress=False)
|
194 |
reset_words.click(lambda x: words_selection(x, True), inputs=[timestamps_var], outputs=[
|