Spaces:
Runtime error
Runtime error
juancopi81
commited on
Commit
·
35afeb7
1
Parent(s):
a2735a4
Add file download option
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ from PIL import Image
|
|
4 |
from diffusers import StableDiffusionPipeline
|
5 |
import gradio as gr
|
6 |
import torch
|
|
|
7 |
|
8 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
9 |
dtype = torch.float16 if device == "cuda" else torch.float32
|
@@ -69,11 +70,10 @@ def infer(prompt, style):
|
|
69 |
style_prompt = prompt + style
|
70 |
image = get_bg_image(style_prompt)
|
71 |
audio = get_music(prompt)
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
)
|
77 |
|
78 |
css = """
|
79 |
#col-container {max-width: 700px; margin-left: auto; margin-right: auto;}
|
@@ -119,7 +119,7 @@ with gr.Blocks(css=css) as demo:
|
|
119 |
send_btn = gr.Button(value="Send", elem_id="submit-btn")
|
120 |
send_btn.click(infer,
|
121 |
inputs=[prompt_input, style_input],
|
122 |
-
outputs=[gr.Video()])
|
123 |
|
124 |
gr.Markdown("""
|
125 |
[![Twitter Follow](https://img.shields.io/twitter/follow/juancopi81?style=social)](https://twitter.com/juancopi81)
|
|
|
4 |
from diffusers import StableDiffusionPipeline
|
5 |
import gradio as gr
|
6 |
import torch
|
7 |
+
from spectro import wav_bytes_from_spectrogram_image
|
8 |
|
9 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
10 |
dtype = torch.float16 if device == "cuda" else torch.float32
|
|
|
70 |
style_prompt = prompt + style
|
71 |
image = get_bg_image(style_prompt)
|
72 |
audio = get_music(prompt)
|
73 |
+
video = gr.make_waveform(audio,
|
74 |
+
bg_image=image,
|
75 |
+
bars_color=random.choice(COLORS))
|
76 |
+
return video, video
|
|
|
77 |
|
78 |
css = """
|
79 |
#col-container {max-width: 700px; margin-left: auto; margin-right: auto;}
|
|
|
119 |
send_btn = gr.Button(value="Send", elem_id="submit-btn")
|
120 |
send_btn.click(infer,
|
121 |
inputs=[prompt_input, style_input],
|
122 |
+
outputs=[gr.Video(), gr.File()])
|
123 |
|
124 |
gr.Markdown("""
|
125 |
[![Twitter Follow](https://img.shields.io/twitter/follow/juancopi81?style=social)](https://twitter.com/juancopi81)
|