Spaces:
Runtime error
Runtime error
RamAnanth1
commited on
Commit
·
f3282ff
1
Parent(s):
aa571ad
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,10 @@ transcript_endpoint = "https://api.assemblyai.com/v2/transcript"
|
|
9 |
|
10 |
upload_endpoint = "https://api.assemblyai.com/v2/upload"
|
11 |
|
|
|
|
|
|
|
|
|
12 |
|
13 |
# Helper function to upload data
|
14 |
def _read_file(filename, chunk_size=5242880):
|
@@ -19,11 +23,7 @@ def _read_file(filename, chunk_size=5242880):
|
|
19 |
break
|
20 |
yield data
|
21 |
|
22 |
-
def get_transcript_url(url
|
23 |
-
headers={
|
24 |
-
"Authorization": api_token,
|
25 |
-
"Content-Type": "application/json"
|
26 |
-
}
|
27 |
|
28 |
# JSON that tells the API which file to trancsribe
|
29 |
json={
|
@@ -84,12 +84,8 @@ def get_transcript_url(url, api_token):
|
|
84 |
time.sleep(3)
|
85 |
return transcription_result['text']
|
86 |
|
87 |
-
def get_transcript_file(filename
|
88 |
-
|
89 |
-
"Authorization": api_token,
|
90 |
-
"Content-Type": "application/json"
|
91 |
-
}
|
92 |
-
|
93 |
upload_response = requests.post(
|
94 |
upload_endpoint,
|
95 |
headers=headers,
|
@@ -158,7 +154,7 @@ def get_transcript_file(filename, api_token):
|
|
158 |
|
159 |
title = """<h1 align="center">🔥Conformer-1 API </h1>"""
|
160 |
description = """
|
161 |
-
|
162 |
"""
|
163 |
|
164 |
with gr.Blocks(css = """#col_container {width: 1000px; margin-left: auto; margin-right: auto;}
|
@@ -166,10 +162,7 @@ with gr.Blocks(css = """#col_container {width: 1000px; margin-left: auto; margin
|
|
166 |
gr.HTML(title)
|
167 |
gr.Markdown(description)
|
168 |
|
169 |
-
assemblyai_api_key = gr.Textbox(type='password', label="Enter your AssemblyAI API key here")
|
170 |
-
|
171 |
with gr.Column(elem_id = "col_container"):
|
172 |
-
|
173 |
with gr.Tab("Audio URL file"):
|
174 |
inputs = gr.Textbox(label = "Enter the url for the audio file")
|
175 |
b1 = gr.Button('Transcribe')
|
|
|
9 |
|
10 |
upload_endpoint = "https://api.assemblyai.com/v2/upload"
|
11 |
|
12 |
+
headers={
|
13 |
+
"Authorization": os.environ["ASSEMBLYAI_KEY"],
|
14 |
+
"Content-Type": "application/json"
|
15 |
+
}
|
16 |
|
17 |
# Helper function to upload data
|
18 |
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={
|
|
|
84 |
time.sleep(3)
|
85 |
return transcription_result['text']
|
86 |
|
87 |
+
def get_transcript_file(filename):
|
88 |
+
|
|
|
|
|
|
|
|
|
89 |
upload_response = requests.post(
|
90 |
upload_endpoint,
|
91 |
headers=headers,
|
|
|
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(css = """#col_container {width: 1000px; margin-left: auto; margin-right: auto;}
|
|
|
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')
|