Spaces:
Runtime error
Runtime error
RamAnanth1
commited on
Commit
·
e6caca8
1
Parent(s):
78ea0db
Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,7 @@ def _read_file(filename, chunk_size=5242880):
|
|
23 |
break
|
24 |
yield data
|
25 |
|
26 |
-
def get_transcript_url(url):
|
27 |
|
28 |
# JSON that tells the API which file to trancsribe
|
29 |
json={
|
@@ -82,7 +82,9 @@ def get_transcript_url(url):
|
|
82 |
raise RuntimeError(f"Transcription failed: {transcription_result['error']}")
|
83 |
else:
|
84 |
time.sleep(3)
|
85 |
-
|
|
|
|
|
86 |
|
87 |
def get_transcript_file(filename):
|
88 |
|
@@ -99,7 +101,7 @@ def get_transcript_file(filename):
|
|
99 |
# Turn on speaker labels
|
100 |
"speaker_labels": True,
|
101 |
|
102 |
-
# Turn on
|
103 |
"word_boost": ["assembly ai"],
|
104 |
|
105 |
# Turn on custom spelling
|
@@ -151,20 +153,24 @@ def get_transcript_file(filename):
|
|
151 |
time.sleep(3)
|
152 |
return transcription_result['text']
|
153 |
|
|
|
|
|
|
|
|
|
154 |
|
155 |
title = """<h1 align="center">🔥Conformer-1 API </h1>"""
|
156 |
description = """
|
157 |
### In this demo, you can explore the outputs of a Conformer-1 Speech Recognition Model from AssemblyAI.
|
158 |
"""
|
159 |
|
160 |
-
with gr.Blocks(
|
161 |
-
""") as demo:
|
162 |
gr.HTML(title)
|
163 |
gr.Markdown(description)
|
164 |
|
165 |
with gr.Column(elem_id = "col_container"):
|
166 |
with gr.Tab("Audio URL file"):
|
167 |
-
inputs = gr.Textbox(label = "Enter the url for the audio file")
|
|
|
168 |
b1 = gr.Button('Transcribe')
|
169 |
|
170 |
with gr.Tab("Upload Audio as File"):
|
@@ -172,12 +178,14 @@ with gr.Blocks(css = """#col_container {width: 1000px; margin-left: auto; margin
|
|
172 |
transcribe_audio_u = gr.Button('Transcribe')
|
173 |
|
174 |
transcript = gr.Textbox(label = "Transcript Result" )
|
|
|
|
|
175 |
|
176 |
-
inputs.submit(get_transcript_url, [inputs], [transcript])
|
177 |
-
b1.click(get_transcript_url, [inputs], [transcript])
|
178 |
transcribe_audio_u.click(get_transcript_file, [audio_input_u], [transcript])
|
179 |
|
180 |
-
examples = gr.Examples(examples = [['https://bit.ly/3yxKEIY']], inputs = inputs, outputs=transcript, cache_examples = True, fn = get_transcript_url)
|
181 |
|
182 |
|
183 |
demo.queue().launch(debug=True)
|
|
|
23 |
break
|
24 |
yield data
|
25 |
|
26 |
+
def get_transcript_url(url, audio_intelligence_options):
|
27 |
|
28 |
# JSON that tells the API which file to trancsribe
|
29 |
json={
|
|
|
82 |
raise RuntimeError(f"Transcription failed: {transcription_result['error']}")
|
83 |
else:
|
84 |
time.sleep(3)
|
85 |
+
|
86 |
+
|
87 |
+
return transcription_result['text'], transcription_result['summary']
|
88 |
|
89 |
def get_transcript_file(filename):
|
90 |
|
|
|
101 |
# Turn on speaker labels
|
102 |
"speaker_labels": True,
|
103 |
|
104 |
+
# Turn on custom vocabulary
|
105 |
"word_boost": ["assembly ai"],
|
106 |
|
107 |
# Turn on custom spelling
|
|
|
153 |
time.sleep(3)
|
154 |
return transcription_result['text']
|
155 |
|
156 |
+
audio_intelligence_list = [
|
157 |
+
"Summarization",
|
158 |
+
"Sentiment Analysis"
|
159 |
+
]
|
160 |
|
161 |
title = """<h1 align="center">🔥Conformer-1 API </h1>"""
|
162 |
description = """
|
163 |
### In this demo, you can explore the outputs of a Conformer-1 Speech Recognition Model from AssemblyAI.
|
164 |
"""
|
165 |
|
166 |
+
with gr.Blocks() as demo:
|
|
|
167 |
gr.HTML(title)
|
168 |
gr.Markdown(description)
|
169 |
|
170 |
with gr.Column(elem_id = "col_container"):
|
171 |
with gr.Tab("Audio URL file"):
|
172 |
+
inputs = gr.Textbox(label = "Enter the url for the audio file")
|
173 |
+
audio_intelligence_options = gr.CheckboxGroup(audio_intelligence_list, label="Audio Intelligence Options")
|
174 |
b1 = gr.Button('Transcribe')
|
175 |
|
176 |
with gr.Tab("Upload Audio as File"):
|
|
|
178 |
transcribe_audio_u = gr.Button('Transcribe')
|
179 |
|
180 |
transcript = gr.Textbox(label = "Transcript Result" )
|
181 |
+
summary = gr.Textbox(label = "Summary Result" )
|
182 |
+
|
183 |
|
184 |
+
inputs.submit(get_transcript_url, [inputs, audio_intelligence_options], [transcript, summary])
|
185 |
+
b1.click(get_transcript_url, [inputs, audio_intelligence_options], [transcript])
|
186 |
transcribe_audio_u.click(get_transcript_file, [audio_input_u], [transcript])
|
187 |
|
188 |
+
#examples = gr.Examples(examples = [['https://bit.ly/3yxKEIY']], inputs = inputs, outputs=transcript, cache_examples = True, fn = get_transcript_url)
|
189 |
|
190 |
|
191 |
demo.queue().launch(debug=True)
|