Spaces:
Running
Running
drewThomasson
commited on
Commit
•
d7b5eaf
1
Parent(s):
f5506fc
Update app.py
Browse files
app.py
CHANGED
@@ -25,33 +25,45 @@ def generate_tts(text, temperature=0.1, repetition_penalty=1.1, max_length=4096)
|
|
25 |
|
26 |
return "output.wav"
|
27 |
|
28 |
-
#
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
print("Launching Gradio interface...")
|
57 |
demo.launch()
|
|
|
25 |
|
26 |
return "output.wav"
|
27 |
|
28 |
+
# Create the Gradio Blocks interface
|
29 |
+
with gr.Blocks() as demo:
|
30 |
+
# Log each interaction
|
31 |
+
def on_text_input(text):
|
32 |
+
print(f"User typed text: {text}")
|
33 |
+
|
34 |
+
def on_temperature_change(val):
|
35 |
+
print(f"Temperature slider adjusted to: {val}")
|
36 |
+
|
37 |
+
def on_repetition_penalty_change(val):
|
38 |
+
print(f"Repetition Penalty slider adjusted to: {val}")
|
39 |
+
|
40 |
+
def on_max_length_change(val):
|
41 |
+
print(f"Max Length slider adjusted to: {val}")
|
42 |
+
|
43 |
+
# Text input
|
44 |
+
text_input = gr.Textbox(lines=2, placeholder="Enter text to convert to speech", label="Text")
|
45 |
+
text_input.change(on_text_input, inputs=text_input)
|
46 |
+
|
47 |
+
# Sliders with change events for tracking
|
48 |
+
temperature_slider = gr.Slider(0.1, 1.0, value=0.1, label="Temperature")
|
49 |
+
temperature_slider.change(on_temperature_change, inputs=temperature_slider)
|
50 |
+
|
51 |
+
repetition_penalty_slider = gr.Slider(1.0, 2.0, value=1.1, label="Repetition Penalty")
|
52 |
+
repetition_penalty_slider.change(on_repetition_penalty_change, inputs=repetition_penalty_slider)
|
53 |
+
|
54 |
+
max_length_slider = gr.Slider(512, 4096, value=4096, step=256, label="Max Length")
|
55 |
+
max_length_slider.change(on_max_length_change, inputs=max_length_slider)
|
56 |
+
|
57 |
+
# Button to generate TTS and Audio output
|
58 |
+
generate_button = gr.Button("Generate Speech")
|
59 |
+
audio_output = gr.Audio(type="filepath", label="Generated Speech")
|
60 |
+
|
61 |
+
# Define interaction between input and output
|
62 |
+
generate_button.click(
|
63 |
+
generate_tts,
|
64 |
+
inputs=[text_input, temperature_slider, repetition_penalty_slider, max_length_slider],
|
65 |
+
outputs=audio_output
|
66 |
+
)
|
67 |
+
|
68 |
print("Launching Gradio interface...")
|
69 |
demo.launch()
|