Spaces:
Sleeping
Sleeping
Commit
·
4e86063
1
Parent(s):
8d98748
feat: Change to Whisper model
Browse files
app.py
CHANGED
|
@@ -23,18 +23,14 @@ load_dotenv()
|
|
| 23 |
|
| 24 |
warnings.filterwarnings("ignore", category=FutureWarning)
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
stroke-linejoin="round" style="display: inline;">
|
| 30 |
-
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
| 31 |
-
<polyline points="17 8 12 3 7 8"/>
|
| 32 |
-
<line x1="12" y1="3" x2="12" y2="15"/>
|
| 33 |
-
</svg>
|
| 34 |
-
"""
|
| 35 |
TITLE = "Røst Speech-to-text Demo"
|
|
|
|
| 36 |
EMAIL_SUBJECT = "Røst tale-til-tekst demo".replace(" ", "+")
|
| 37 |
-
EMAIL_BODY = """
|
|
|
|
| 38 |
|
| 39 |
Jeg har lige prøvet jeres Røst tale-til-tekst demo, og jeg er imponeret!
|
| 40 |
|
|
@@ -43,15 +39,26 @@ Jeg kunne godt tænke mig at høre mere om jeres talegenkendelsesløsninger.
|
|
| 43 |
Min use case er [indsæt use case her].
|
| 44 |
|
| 45 |
Venlig hilsen,
|
| 46 |
-
[dit navn]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
DESCRIPTION = f"""
|
| 48 |
This is a demo of the Danish speech recognition model
|
| 49 |
-
[Røst](https://huggingface.co/
|
| 50 |
|
| 51 |
Press "Record" to record your
|
| 52 |
own voice. When you're done you can press "Stop" to stop recording and "Submit" to
|
| 53 |
send the audio to the model for transcription. You can also upload an audio file by
|
| 54 |
-
pressing the {
|
| 55 |
|
| 56 |
_If you like what you see and are interested in integrating speech-to-text solutions
|
| 57 |
into your products, feel free to
|
|
@@ -62,7 +69,7 @@ logger.info("Loading the ASR model...")
|
|
| 62 |
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
|
| 63 |
transcriber = pipeline(
|
| 64 |
task="automatic-speech-recognition",
|
| 65 |
-
model=
|
| 66 |
device=device,
|
| 67 |
)
|
| 68 |
|
|
|
|
| 23 |
|
| 24 |
warnings.filterwarnings("ignore", category=FutureWarning)
|
| 25 |
|
| 26 |
+
|
| 27 |
+
MODEL_ID = "alexandrainst/roest-whisper-1.5b-all-datasets"
|
| 28 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
TITLE = "Røst Speech-to-text Demo"
|
| 30 |
+
|
| 31 |
EMAIL_SUBJECT = "Røst tale-til-tekst demo".replace(" ", "+")
|
| 32 |
+
EMAIL_BODY = """
|
| 33 |
+
Hej,
|
| 34 |
|
| 35 |
Jeg har lige prøvet jeres Røst tale-til-tekst demo, og jeg er imponeret!
|
| 36 |
|
|
|
|
| 39 |
Min use case er [indsæt use case her].
|
| 40 |
|
| 41 |
Venlig hilsen,
|
| 42 |
+
[dit navn]
|
| 43 |
+
""".strip().replace(" ", "+").replace("\n", "%0D")
|
| 44 |
+
|
| 45 |
+
ICON = """
|
| 46 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="14px" viewBox="0 0 24 24" fill="none"
|
| 47 |
+
stroke="currentColor" stroke-width="2" stroke-linecap="round"
|
| 48 |
+
stroke-linejoin="round" style="display: inline;">
|
| 49 |
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
| 50 |
+
<polyline points="17 8 12 3 7 8"/>
|
| 51 |
+
<line x1="12" y1="3" x2="12" y2="15"/>
|
| 52 |
+
</svg>
|
| 53 |
+
"""
|
| 54 |
DESCRIPTION = f"""
|
| 55 |
This is a demo of the Danish speech recognition model
|
| 56 |
+
[Røst](https://huggingface.co/{MODEL_ID}).
|
| 57 |
|
| 58 |
Press "Record" to record your
|
| 59 |
own voice. When you're done you can press "Stop" to stop recording and "Submit" to
|
| 60 |
send the audio to the model for transcription. You can also upload an audio file by
|
| 61 |
+
pressing the {ICON} button.
|
| 62 |
|
| 63 |
_If you like what you see and are interested in integrating speech-to-text solutions
|
| 64 |
into your products, feel free to
|
|
|
|
| 69 |
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
|
| 70 |
transcriber = pipeline(
|
| 71 |
task="automatic-speech-recognition",
|
| 72 |
+
model=MODEL_ID,
|
| 73 |
device=device,
|
| 74 |
)
|
| 75 |
|