Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,11 +8,8 @@ import io
|
|
8 |
|
9 |
def hide_notice():
|
10 |
return gr.update(visible=False)
|
11 |
-
def
|
12 |
-
return gr.update(visible=True)
|
13 |
-
|
14 |
-
def hide_popup():
|
15 |
-
return gr.update(visible=False)
|
16 |
|
17 |
def audio_to_bytes(audio):
|
18 |
data, sr = sf.read(audio)
|
@@ -225,98 +222,104 @@ demo = gr.Blocks(css=css_content) #, fill_width=True)
|
|
225 |
with demo:
|
226 |
|
227 |
intro = gr.Column(visible=True, elem_id="intro-message")
|
|
|
|
|
|
|
|
|
|
|
228 |
with intro:
|
229 |
gr.Markdown("""
|
230 |
Welcome!
|
231 |
-
|
232 |
⚠️ The recordings are not saved and are automatically removed.
|
233 |
""")
|
234 |
ok_button = gr.Button("OK")
|
235 |
-
ok_button.click(fn=
|
236 |
-
|
237 |
-
|
238 |
-
gr.HTML("""
|
239 |
-
<div id="header">
|
240 |
-
<h1>LANGSWITCH</h1>
|
241 |
-
<h3>Multilingual Automatic Speech Recognition in noisy environments</h3>
|
242 |
-
</div>
|
243 |
-
""")
|
244 |
-
|
245 |
-
with gr.Tab("Transcribe microphone"):
|
246 |
-
iface = gr.Interface(
|
247 |
-
fn=transcribe_mic,
|
248 |
-
inputs=[
|
249 |
-
gr.Audio(sources="microphone", type="filepath"),
|
250 |
-
gr.Dropdown(label="Language", choices=[("English", "en"),
|
251 |
-
("Euskara", "eu"),
|
252 |
-
("Español", "es"),
|
253 |
-
("Français", "fr"),
|
254 |
-
("Italiano", "it")],
|
255 |
-
value="en")
|
256 |
-
],
|
257 |
-
outputs=[
|
258 |
-
gr.Textbox(label="Transcription", autoscroll=False),
|
259 |
-
#gr.Textbox(label="Speaker Identification", autoscroll=False)
|
260 |
-
],
|
261 |
-
allow_flagging="never",
|
262 |
-
)
|
263 |
|
264 |
-
with
|
265 |
-
iface = gr.Interface(
|
266 |
-
fn=transcribe_file,
|
267 |
-
inputs=[
|
268 |
-
gr.Audio(sources="upload", type="filepath"),
|
269 |
-
gr.Dropdown(choices=[("English", "en"),
|
270 |
-
("Euskara", "eu"),
|
271 |
-
("Español", "es"),
|
272 |
-
("Français", "fr"),
|
273 |
-
("Italiano", "it")],
|
274 |
-
value="en")
|
275 |
-
],
|
276 |
-
outputs=[
|
277 |
-
gr.Textbox(label="Transcription", autoscroll=False),
|
278 |
-
#gr.Textbox(label="Speaker Identification", autoscroll=False)
|
279 |
-
],
|
280 |
-
allow_flagging="never",
|
281 |
-
)
|
282 |
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
</div>
|
311 |
-
<img src="https://www.orai.eus/themes/custom/orai_for_drupal9/orai_bw.svg" width=175/>
|
312 |
-
</div>
|
313 |
-
<div id="orai-info-text">
|
314 |
-
<p>The <span class="bold">LANGSWITCH</span> sub-project is part of the Open Call 1 of the <span class="bold">SERMAS</span> project. The goal of the <span class="bold">SERMAS</span> project is to provide socially-acceptable extended reality models and systems.</p>
|
315 |
-
<p>The technology powering LANGSWITCH was developed by <span class="bold">Orai NLP Teknologiak</span></p>
|
316 |
-
<p><span class="bold">Orai NLP Teknologiak</span> specializes in research, development, and innovation in artificial intelligence, with a focus on fostering a more competitive industrial and business landscape, enhancing public administration efficiency, and promoting a more inclusive society.</p>
|
317 |
</div>
|
318 |
-
|
319 |
-
<p>""")
|
320 |
|
321 |
demo.queue(max_size=1)
|
322 |
#demo.launch(share=False, max_threads=3, auth=(os.getenv("username"), os.getenv("password")), auth_message="Please provide a username and a password.")
|
|
|
8 |
|
9 |
def hide_notice():
|
10 |
return gr.update(visible=False)
|
11 |
+
def start_app():
|
12 |
+
return gr.update(visible=False), gr.update(visible=True)
|
|
|
|
|
|
|
13 |
|
14 |
def audio_to_bytes(audio):
|
15 |
data, sr = sf.read(audio)
|
|
|
222 |
with demo:
|
223 |
|
224 |
intro = gr.Column(visible=True, elem_id="intro-message")
|
225 |
+
app_block = gr.Column(visible=False)
|
226 |
+
|
227 |
+
def start_app():
|
228 |
+
return gr.update(visible=False), gr.update(visible=True)
|
229 |
+
|
230 |
with intro:
|
231 |
gr.Markdown("""
|
232 |
Welcome!
|
233 |
+
|
234 |
⚠️ The recordings are not saved and are automatically removed.
|
235 |
""")
|
236 |
ok_button = gr.Button("OK")
|
237 |
+
ok_button.click(fn=start_app, outputs=[intro, app_block])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
|
239 |
+
with app_block:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
|
241 |
+
gr.HTML("""
|
242 |
+
<div id="header">
|
243 |
+
<h1>LANGSWITCH</h1>
|
244 |
+
<h3>Multilingual Automatic Speech Recognition in noisy environments</h3>
|
245 |
+
</div>
|
246 |
+
""")
|
247 |
+
|
248 |
+
with gr.Tab("Transcribe microphone"):
|
249 |
+
iface = gr.Interface(
|
250 |
+
fn=transcribe_mic,
|
251 |
+
inputs=[
|
252 |
+
gr.Audio(sources="microphone", type="filepath"),
|
253 |
+
gr.Dropdown(label="Language", choices=[("English", "en"),
|
254 |
+
("Euskara", "eu"),
|
255 |
+
("Español", "es"),
|
256 |
+
("Français", "fr"),
|
257 |
+
("Italiano", "it")],
|
258 |
+
value="en")
|
259 |
+
],
|
260 |
+
outputs=[
|
261 |
+
gr.Textbox(label="Transcription", autoscroll=False),
|
262 |
+
#gr.Textbox(label="Speaker Identification", autoscroll=False)
|
263 |
+
],
|
264 |
+
allow_flagging="never",
|
265 |
+
)
|
266 |
+
|
267 |
+
with gr.Tab("Transcribe local file"):
|
268 |
+
iface = gr.Interface(
|
269 |
+
fn=transcribe_file,
|
270 |
+
inputs=[
|
271 |
+
gr.Audio(sources="upload", type="filepath"),
|
272 |
+
gr.Dropdown(choices=[("English", "en"),
|
273 |
+
("Euskara", "eu"),
|
274 |
+
("Español", "es"),
|
275 |
+
("Français", "fr"),
|
276 |
+
("Italiano", "it")],
|
277 |
+
value="en")
|
278 |
+
],
|
279 |
+
outputs=[
|
280 |
+
gr.Textbox(label="Transcription", autoscroll=False),
|
281 |
+
#gr.Textbox(label="Speaker Identification", autoscroll=False)
|
282 |
+
],
|
283 |
+
allow_flagging="never",
|
284 |
+
)
|
285 |
|
286 |
+
###############################
|
287 |
+
#popup = gr.Column(visible=False, elem_classes="popup-overlay")
|
288 |
+
#with popup:
|
289 |
+
# with gr.Column(elem_classes=["popup-box"]):
|
290 |
+
# gr.Markdown(
|
291 |
+
# """
|
292 |
+
# ### ℹ️ Notice
|
293 |
+
#
|
294 |
+
# Grabaketak ez dira gordetzen eta automatikoki ezabatzen dira.
|
295 |
+
# No se guardan las grabaciones y se eliminan automáticamente.
|
296 |
+
# The recordings are not saved and are automatically removed.
|
297 |
+
# """
|
298 |
+
# )
|
299 |
+
# ok_btn = gr.Button("OK", elem_classes=["popup-button"])
|
300 |
+
# ok_btn.click(fn=hide_popup, outputs=popup)
|
301 |
+
|
302 |
+
## Show on load
|
303 |
+
#demo.load(fn=show_popup, outputs=popup)
|
304 |
+
#
|
305 |
+
###################
|
306 |
+
|
307 |
+
gr.HTML("""
|
308 |
+
<div id="orai-info">
|
309 |
+
<div class="logos">
|
310 |
+
<div class="sermas-logo">
|
311 |
+
<img src="https://sermasproject.eu/wp-content/uploads/2023/04/sermas-logo.png" width=100/>
|
312 |
+
<span>SERMAS</span>
|
313 |
+
</div>
|
314 |
+
<img src="https://www.orai.eus/themes/custom/orai_for_drupal9/orai_bw.svg" width=175/>
|
315 |
+
</div>
|
316 |
+
<div id="orai-info-text">
|
317 |
+
<p>The <span class="bold">LANGSWITCH</span> sub-project is part of the Open Call 1 of the <span class="bold">SERMAS</span> project. The goal of the <span class="bold">SERMAS</span> project is to provide socially-acceptable extended reality models and systems.</p>
|
318 |
+
<p>The technology powering LANGSWITCH was developed by <span class="bold">Orai NLP Teknologiak</span></p>
|
319 |
+
<p><span class="bold">Orai NLP Teknologiak</span> specializes in research, development, and innovation in artificial intelligence, with a focus on fostering a more competitive industrial and business landscape, enhancing public administration efficiency, and promoting a more inclusive society.</p>
|
320 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
</div>
|
322 |
+
<p>""")
|
|
|
323 |
|
324 |
demo.queue(max_size=1)
|
325 |
#demo.launch(share=False, max_threads=3, auth=(os.getenv("username"), os.getenv("password")), auth_message="Please provide a username and a password.")
|