Spaces:
Sleeping
Sleeping
fix: UI changes
Browse files
app.py
CHANGED
|
@@ -25,14 +25,18 @@ class GradioApp():
|
|
| 25 |
self.model.load_state_dict(self.checkpoint)
|
| 26 |
self.model.eval()
|
| 27 |
|
| 28 |
-
#Setup Interface
|
| 29 |
-
self.input = gr.Button("")
|
| 30 |
-
self.output = gr.Audio(label="Generated Music")
|
| 31 |
-
# self.output = gr.Textbox("")
|
| 32 |
-
self.interface = gr.Interface(fn=self.generate_music, inputs=self.input, outputs=self.output, title="AI Music Generator", description="Generate a new song using a trained RNN model.")
|
| 33 |
-
|
| 34 |
def launch(self):
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
def generate_music(self, input):
|
| 38 |
"""Generate a new song using the trained model."""
|
|
|
|
| 25 |
self.model.load_state_dict(self.checkpoint)
|
| 26 |
self.model.eval()
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
def launch(self):
|
| 29 |
+
# Define Gradio interface without a clear button
|
| 30 |
+
with gr.Blocks() as demo:
|
| 31 |
+
gr.Markdown("# AI Music Generator")
|
| 32 |
+
gr.Markdown("Click the button below to generate a new random song using a trained RNN model.")
|
| 33 |
+
|
| 34 |
+
generate_button = gr.Button("Generate Music")
|
| 35 |
+
output_audio = gr.Audio(label="Generated Music")
|
| 36 |
+
|
| 37 |
+
generate_button.click(self.generate_music, inputs=None, outputs=output_audio)
|
| 38 |
+
|
| 39 |
+
demo.launch()
|
| 40 |
|
| 41 |
def generate_music(self, input):
|
| 42 |
"""Generate a new song using the trained model."""
|