andfaa commited on
Commit
956b4e3
·
verified ·
1 Parent(s): 87e2365

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Last inn norsk chatterbox-tts-modell
5
+ tts = pipeline(
6
+ "text-to-speech",
7
+ model="akhbar/chatterbox-tts-norwegian",
8
+ device="cpu"
9
+ )
10
+
11
+ def speak(text):
12
+ audio = tts(text)
13
+ return (16000, audio["audio"])
14
+
15
+ title = "Norsk Bokmål TTS – akhbar/chatterbox-tts-norwegian"
16
+
17
+ description = """
18
+ Denne demoen bruker Hugging Face-modellen **akhbar/chatterbox-tts-norwegian**
19
+ for å generere norsk bokmål tekst-til-tale.
20
+ """
21
+
22
+ gr.Interface(
23
+ fn=speak,
24
+ inputs=gr.Textbox(label="Skriv tekst på norsk bokmål"),
25
+ outputs=gr.Audio(label="Generert tale"),
26
+ title=title,
27
+ description=description
28
+ ).launch()