Spaces:
Runtime error
Runtime error
juancopi81
commited on
Commit
•
b0c7882
1
Parent(s):
78e5ece
Add styles/duplicate/buymeacoffe/ options
Browse files
app.py
CHANGED
@@ -29,6 +29,20 @@ title = """
|
|
29 |
<div style="display: inline-flex; align-items: center; gap: 0.8rem; font-size: 1.75rem;">
|
30 |
<h1 style="font-weight: 950; margin-bottom: 7px; color: #000; font-weight: bold;">Riffusion and Stable Diffusion</h1>
|
31 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
</div>
|
33 |
"""
|
34 |
def get_bg_image(prompt):
|
@@ -51,8 +65,9 @@ def get_music(prompt):
|
|
51 |
f.write(wav[0].getbuffer())
|
52 |
return "output.wav"
|
53 |
|
54 |
-
def infer(prompt):
|
55 |
-
|
|
|
56 |
audio = get_music(prompt)
|
57 |
return (
|
58 |
gr.make_waveform(audio,
|
@@ -67,6 +82,11 @@ css = """
|
|
67 |
border-radius: 2px;
|
68 |
padding: 8px;
|
69 |
}
|
|
|
|
|
|
|
|
|
|
|
70 |
#btn-container {
|
71 |
display: flex;
|
72 |
align-items: center;
|
@@ -90,11 +110,20 @@ with gr.Blocks(css=css) as demo:
|
|
90 |
with gr.Column(elem_id="col-container"):
|
91 |
prompt_input = gr.Textbox(placeholder="The Beatles playing for the queen",
|
92 |
elem_id="prompt-in",
|
93 |
-
label="Enter your music prompt")
|
|
|
|
|
|
|
|
|
94 |
with gr.Row(elem_id="btn-container"):
|
95 |
send_btn = gr.Button(value="Send", elem_id="submit-btn")
|
96 |
send_btn.click(infer,
|
97 |
-
inputs=[prompt_input],
|
98 |
outputs=[gr.Video()])
|
99 |
|
|
|
|
|
|
|
|
|
|
|
100 |
demo.launch(debug=True)
|
|
|
29 |
<div style="display: inline-flex; align-items: center; gap: 0.8rem; font-size: 1.75rem;">
|
30 |
<h1 style="font-weight: 950; margin-bottom: 7px; color: #000; font-weight: bold;">Riffusion and Stable Diffusion</h1>
|
31 |
</div>
|
32 |
+
<p style="text-align: center;font-size: 94%">
|
33 |
+
Duplicate this Space and run it on your own profile using a (paid) private T4-small or A10G-small GPU for training:
|
34 |
+
<span style="display: flex;align-items: center;justify-content: center;height: 30px;">
|
35 |
+
<a href="https://huggingface.co/spaces/juancopi81/sd-riffusion?duplicate=true">
|
36 |
+
<img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a>
|
37 |
+
</span>
|
38 |
+
</p>
|
39 |
+
<p style="text-align: center;font-size: 94%">
|
40 |
+
You can buy me a coffee to support this space:
|
41 |
+
<span style="display: flex;align-items: center;justify-content: center;height: 30px;">
|
42 |
+
<a href="https://huggingface.co/spaces/juancopi81/sd-riffusion?duplicate=true">
|
43 |
+
<img src="https://badgen.net/badge/icon/Buy%20Me%20A%20Coffee?icon=buymeacoffee&label" alt="Buy me a coffee"></a>. Depending on the support, I'll keep this space running and add more features!
|
44 |
+
</span>
|
45 |
+
</p>
|
46 |
</div>
|
47 |
"""
|
48 |
def get_bg_image(prompt):
|
|
|
65 |
f.write(wav[0].getbuffer())
|
66 |
return "output.wav"
|
67 |
|
68 |
+
def infer(prompt, style):
|
69 |
+
style_prompt = prompt + style
|
70 |
+
image = get_bg_image(style_prompt)
|
71 |
audio = get_music(prompt)
|
72 |
return (
|
73 |
gr.make_waveform(audio,
|
|
|
82 |
border-radius: 2px;
|
83 |
padding: 8px;
|
84 |
}
|
85 |
+
#prompt-style {
|
86 |
+
border: 2px solid #666;
|
87 |
+
border-radius: 2px;
|
88 |
+
padding: 8px;
|
89 |
+
}
|
90 |
#btn-container {
|
91 |
display: flex;
|
92 |
align-items: center;
|
|
|
110 |
with gr.Column(elem_id="col-container"):
|
111 |
prompt_input = gr.Textbox(placeholder="The Beatles playing for the queen",
|
112 |
elem_id="prompt-in",
|
113 |
+
label="Enter your music prompt.")
|
114 |
+
style_input = gr.Textbox(placeholder="In the style of Vincent van Gogh",
|
115 |
+
elem_id="prompt-style",
|
116 |
+
label="(Optional) Add styles to your background image.",
|
117 |
+
value="")
|
118 |
with gr.Row(elem_id="btn-container"):
|
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)
|
126 |
+
![visitors](https://visitor-badge.glitch.me/badge?page_id=Juancopi81.sd-riffusion)
|
127 |
+
""")
|
128 |
+
|
129 |
demo.launch(debug=True)
|