SL-TTS / app.py
Kartik Basavaraj
Modified text font size
18bc61f
Raw
History Blame Contribute Delete
6.34 kB
import gradio as gr
SAMPLES = [
{"transcript": "Hello, this is Priya from customer support. [clears throat] I'm calling regarding your refund request. The amount has been processed and should appear in your account within three business days.", "file": "samples/sample_01.wav"},
{"transcript": "Hey Rahul, are we still meeting for dinner tonight? [chuckles] I actually reached early for once, [m_laugh] so don't make me wait outside again.", "file": "samples/sample_02.wav"},
{"transcript": "Good morning. [m_clear throat] You have a meeting with the research team at 10 A.M., followed by a dentist appointment in the evening.", "file": "samples/sample_03.wav"},
{"transcript": "The current temperature is twenty-seven degrees Celsius. [clears throat] Light rain is expected after 4 P.M., so carrying an umbrella is recommended.", "file": "samples/sample_04.wav"},
{"transcript": "Did you finish your homework before watching videos? [sigh] Dinner is almost ready, and I've reminded you several times already.", "file": "samples/sample_05.wav"},
{"transcript": "Your order is currently being prepared and should arrive soon. [m_clear throat] Thank you for choosing our delivery service today.", "file": "samples/sample_06.wav"},
{"transcript": "Hello, this is a reminder for your appointment tomorrow at 11:30 A.M. [clears throat] Please arrive ten minutes early for registration.", "file": "samples/sample_07.wav"},
{"transcript": "We need to finalize the evaluation report before Friday. [m_sigh] Can you also review the benchmark results after lunch?", "file": "samples/sample_08.wav"},
{"transcript": "Attention passengers traveling to Bengaluru. [clears throat] Your flight has been delayed due to weather conditions. We regret the inconvenience.", "file": "samples/sample_09.wav"},
{"transcript": "This is an automated security notification. [m_clear_throat] A login attempt was detected from a new device associated with your account.", "file": "samples/sample_10.wav"},
{"transcript": "Hey, you sounded stressed yesterday. [m_sigh] I just wanted to know if you're feeling any better today.", "file": "samples/sample_11.wav"},
{"transcript": "The living room lights are now turned off. [clears throat] Your washing machine cycle will finish in approximately twelve minutes.", "file": "samples/sample_12.wav"},
{"transcript": "Please submit your assignments before midnight today. [sigh] Late submissions may receive reduced marks without prior approval.", "file": "samples/sample_13.wav"},
{"transcript": "Hi, I ordered a laptop last week and it still hasn't arrived. [sigh] I need an update because this delay is affecting my work.", "file": "samples/sample_14.wav"},
{"transcript": "Warning. Heavy rainfall may cause flooding in nearby areas tonight. [m_clear_throat] Residents are advised to avoid unnecessary travel.", "file": "samples/sample_15.wav"},
{"transcript": "We should leave early on Saturday morning to avoid traffic. [s_laugh] Last time we spent four hours stuck on the highway.", "file": "samples/sample_16.wav"},
{"transcript": "Hello, I'm calling regarding your interview for the machine learning engineer role. [clears throat] We'd like to schedule a technical discussion this week.", "file": "samples/sample_17.wav"},
{"transcript": "I found three products matching your search query. [m_clear_throat] The highest-rated option currently has a fifteen percent discount.", "file": "samples/sample_18.wav"},
{"transcript": "[s_laugh] When I was your age, we walked to school every day. Even during heavy rain, we carried books in plastic covers.", "file": "samples/sample_19.wav"},
{"transcript": "Did you watch the new AI demo yesterday? [chuckles] The response speed looked impressive, [m_sigh] though a few answers were inaccurate.", "file": "samples/sample_20.wav"},
]
css = """
body, .gradio-container {
background-color: #0f0f0f !important;
color: #e0e0e0 !important;
font-family: 'Segoe UI', sans-serif;
}
.header-box {
background: #1a1a1a;
border: 1px solid #2a2a2a;
border-radius: 8px;
padding: 16px 20px;
margin-bottom: 16px;
}
.section-label {
font-size: 0.78em !important;
font-weight: 600 !important;
color: #888 !important;
text-transform: uppercase;
letter-spacing: 0.08em;
margin-bottom: 10px !important;
}
.sample-row {
border: 1px solid #222 !important;
border-radius: 6px !important;
padding: 8px 12px !important;
margin-bottom: 6px !important;
background: #161616 !important;
align-items: center !important;
}
.sample-row p {
font-size: 1.08rem !important;
color: #e6e6e6 !important;
margin: 0 !important;
line-height: 1.75 !important;
font-weight: 400 !important;
}
hr { border-color: #222 !important; margin: 20px 0 !important; }
footer { display: none !important; }
"""
with gr.Blocks(title="SL TTS Demo") as demo:
gr.HTML("""
<div class="header-box">
<div style="font-weight:700; font-size:1.05em; margin-bottom:4px;">
SwaraTTS: Lightweight Expressive Speech Synthesis through Non- Verbal SSML
</div>
<div style="color:#aaa; font-size:0.88em;">
Swara TTS Demo &nbsp;路&nbsp; English &nbsp;路&nbsp; Single Female Voice
&nbsp;|&nbsp;
<a href="#" style="color:#e8640a; text-decoration:none;">馃搫 Paper</a>
</div>
</div>
""")
gr.HTML('<div class="section-label">馃搨 Audio Samples</div>')
for i, sample in enumerate(SAMPLES):
with gr.Row(elem_classes=["sample-row"]):
with gr.Column(scale=6, min_width=500):
gr.HTML(
f"""
<div style="
font-size:1.08rem;
line-height:1.75;
color:#e6e6e6;
padding-right:20px;
">
<b>{i + 1}.</b> {sample['transcript']}
</div>
"""
)
with gr.Column(scale=4, min_width=350):
gr.Audio(
value=sample["file"],
label="",
interactive=False,
)
demo.launch(
theme=gr.themes.Base(),
css=css,
)