Spaces:
Build error
Build error
Add informative description to gradio demo
Browse files
app.py
CHANGED
|
@@ -2,16 +2,15 @@ import gradio as gr
|
|
| 2 |
import whisper
|
| 3 |
from pybraille import convertText
|
| 4 |
|
| 5 |
-
# Translate speech to braille
|
| 6 |
-
model = whisper.load_model('base')
|
| 7 |
-
|
| 8 |
|
|
|
|
| 9 |
def speech_to_text(audio):
|
| 10 |
"""
|
| 11 |
|
| 12 |
:param audio: Speech data
|
| 13 |
:return: Transcript of speech data
|
| 14 |
"""
|
|
|
|
| 15 |
|
| 16 |
return model.transcribe(audio)
|
| 17 |
|
|
@@ -36,6 +35,11 @@ def transcribe_audio(audio, store=None):
|
|
| 36 |
|
| 37 |
# Setup gradio interface
|
| 38 |
title = "Speech to Braille Translator"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
transcription_tb = gr.Textbox(label="Transcription", lines=10, max_lines=20)
|
| 40 |
detected_lang = gr.outputs.HTML(label="Detected Language")
|
| 41 |
transcription_braille = gr.Textbox(label="Braille", lines=10, max_lines=20)
|
|
@@ -57,6 +61,7 @@ demo = gr.Interface(fn=transcribe_audio,
|
|
| 57 |
# live=True,
|
| 58 |
allow_flagging='never',
|
| 59 |
title=title,
|
|
|
|
| 60 |
)
|
| 61 |
|
| 62 |
# Launch gradio app
|
|
|
|
| 2 |
import whisper
|
| 3 |
from pybraille import convertText
|
| 4 |
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
# Translate speech to braille
|
| 7 |
def speech_to_text(audio):
|
| 8 |
"""
|
| 9 |
|
| 10 |
:param audio: Speech data
|
| 11 |
:return: Transcript of speech data
|
| 12 |
"""
|
| 13 |
+
model = whisper.load_model('base')
|
| 14 |
|
| 15 |
return model.transcribe(audio)
|
| 16 |
|
|
|
|
| 35 |
|
| 36 |
# Setup gradio interface
|
| 37 |
title = "Speech to Braille Translator"
|
| 38 |
+
description = 'This is a Speech to Braille translation demo. The speech-text translation uses the OpenAI ' \
|
| 39 |
+
'[Whisper](https://openai.com/blog/whisper/) [model](https://github.com/openai/whisper) whilst the text-braille' \
|
| 40 |
+
'component utilises the [PyBraille](https://pypi.org/project/pybraille/) library. You can find the project on ' \
|
| 41 |
+
'[Github](https://github.com/Azuremis/speech_to_braille_translator). Made by [Azuremis](https://azuremis.bio.link).'
|
| 42 |
+
|
| 43 |
transcription_tb = gr.Textbox(label="Transcription", lines=10, max_lines=20)
|
| 44 |
detected_lang = gr.outputs.HTML(label="Detected Language")
|
| 45 |
transcription_braille = gr.Textbox(label="Braille", lines=10, max_lines=20)
|
|
|
|
| 61 |
# live=True,
|
| 62 |
allow_flagging='never',
|
| 63 |
title=title,
|
| 64 |
+
description=description,
|
| 65 |
)
|
| 66 |
|
| 67 |
# Launch gradio app
|