File size: 677 Bytes
956b4e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import gradio as gr
from transformers import pipeline

# Last inn norsk chatterbox-tts-modell
tts = pipeline(
    "text-to-speech",
    model="akhbar/chatterbox-tts-norwegian",
    device="cpu"
)

def speak(text):
    audio = tts(text)
    return (16000, audio["audio"])

title = "Norsk Bokmål TTS – akhbar/chatterbox-tts-norwegian"

description = """
Denne demoen bruker Hugging Face-modellen **akhbar/chatterbox-tts-norwegian**  
for å generere norsk bokmål tekst-til-tale.
"""

gr.Interface(
    fn=speak,
    inputs=gr.Textbox(label="Skriv tekst på norsk bokmål"),
    outputs=gr.Audio(label="Generert tale"),
    title=title,
    description=description
).launch()