ysharma HF staff commited on
Commit
2894b82
1 Parent(s): f340743
Files changed (1) hide show
  1. app.py +34 -29
app.py CHANGED
@@ -112,8 +112,8 @@ with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo:
112
  Generate audio from text using a diffusion transformer. Adjust advanced settings for more control.
113
  """)
114
 
115
- # Basic Input: Text prompt and Audio Length
116
- # with gr.Row():
117
  text_input = gr.Textbox(
118
  label="Text Prompt",
119
  show_label=True,
@@ -121,36 +121,41 @@ with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo:
121
  placeholder="Enter your prompt",
122
  container=True,
123
  value="a dog barking in the distance",
 
124
  )
125
- length_input = gr.Slider(minimum=1, maximum=10, step=1, value=10, label="Audio Length (in seconds)")
126
-
127
- # Output Component
128
- result = gr.Audio(label="Result", type="numpy")
129
-
130
- # Advanced settings in an Accordion
131
- with gr.Accordion("Advanced Settings", open=False):
132
- guidance_scale = gr.Slider(minimum=1.0, maximum=10, step=0.1, value=5.0, label="Guidance Scale")
133
- guidance_rescale = gr.Slider(minimum=0.0, maximum=1, step=0.05, value=0.75, label="Guidance Rescale")
134
- ddim_steps = gr.Slider(minimum=25, maximum=200, step=5, value=50, label="DDIM Steps")
135
- eta = gr.Slider(minimum=0.0, maximum=1.0, step=0.1, value=1.0, label="Eta")
136
- seed = gr.Slider(minimum=0, maximum=MAX_SEED, step=1, value=0, label="Seed")
137
- randomize_seed = gr.Checkbox(label="Randomize Seed (Disable Seed)", value=True)
138
-
139
- # Examples block
140
- gr.Examples(
141
- examples=examples,
142
- inputs=[text_input]
143
- )
144
-
145
  # Run button
146
- run_button = gr.Button("Generate")
147
 
148
- # Define the trigger and input-output linking
149
- run_button.click(
150
- fn=generate_audio,
151
- inputs=[text_input, length_input, guidance_scale, guidance_rescale, ddim_steps, eta, seed, randomize_seed],
152
- outputs=[result]
153
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
 
155
  # Launch the Gradio demo
156
  demo.launch()
 
112
  Generate audio from text using a diffusion transformer. Adjust advanced settings for more control.
113
  """)
114
 
115
+ # Basic Input: Text prompt
116
+ with gr.Row():
117
  text_input = gr.Textbox(
118
  label="Text Prompt",
119
  show_label=True,
 
121
  placeholder="Enter your prompt",
122
  container=True,
123
  value="a dog barking in the distance",
124
+ scale=4
125
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  # Run button
127
+ run_button = gr.Button("Generate", scale=1)
128
 
129
+ # Output Component
130
+ result = gr.Audio(label="Result", type="numpy")
131
+
132
+ # Advanced settings in an Accordion
133
+ with gr.Accordion("Advanced Settings", open=False):
134
+ # Audio Length
135
+ length_input = gr.Slider(minimum=1, maximum=10, step=1, value=10, label="Audio Length (in seconds)")
136
+ guidance_scale = gr.Slider(minimum=1.0, maximum=10, step=0.1, value=5.0, label="Guidance Scale")
137
+ guidance_rescale = gr.Slider(minimum=0.0, maximum=1, step=0.05, value=0.75, label="Guidance Rescale")
138
+ ddim_steps = gr.Slider(minimum=25, maximum=200, step=5, value=50, label="DDIM Steps")
139
+ eta = gr.Slider(minimum=0.0, maximum=1.0, step=0.1, value=1.0, label="Eta")
140
+ seed = gr.Slider(minimum=0, maximum=100, step=1, value=0, label="Seed")
141
+ randomize_seed = gr.Checkbox(label="Randomize Seed (Disable Seed)", value=True)
142
+
143
+ # Examples block
144
+ gr.Examples(
145
+ examples=examples,
146
+ inputs=[text_input]
147
+ )
148
+
149
+ # Define the trigger and input-output linking
150
+ run_button.click(
151
+ fn=generate_audio,
152
+ inputs=[text_input, length_input, guidance_scale, guidance_rescale, ddim_steps, eta, seed, randomize_seed],
153
+ outputs=[result]
154
+ )
155
+ text_input.submit(fn=generate_audio,
156
+ inputs=[text_input, length_input, guidance_scale, guidance_rescale, ddim_steps, eta, seed, randomize_seed],
157
+ outputs=[result]
158
+ )
159
 
160
  # Launch the Gradio demo
161
  demo.launch()