Spaces:
Sleeping
Sleeping
commit
Browse files
app.py
CHANGED
@@ -20,12 +20,10 @@ from functools import partial
|
|
20 |
import spaces
|
21 |
import torch
|
22 |
import gradio as gr
|
23 |
-
from numpy import asarray as array
|
24 |
from lxml.html import fromstring
|
25 |
-
from diffusers.utils import export_to_video, load_image
|
26 |
from huggingface_hub import hf_hub_download
|
27 |
from safetensors.torch import load_file, save_file
|
28 |
-
from diffusers import FluxPipeline
|
29 |
from PIL import Image, ImageDraw, ImageFont
|
30 |
|
31 |
# logging
|
@@ -48,10 +46,6 @@ else:
|
|
48 |
|
49 |
base = "black-forest-labs/FLUX.1-schnell"
|
50 |
|
51 |
-
# variable data
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
# precision data
|
56 |
|
57 |
seq=512
|
@@ -187,7 +181,9 @@ def handle_generate(artist,song,genre,lyrics):
|
|
187 |
img.save(name)
|
188 |
return name
|
189 |
|
190 |
-
|
|
|
|
|
191 |
with gr.Blocks(theme=gr.themes.Citrus(),css=css,js=js) as demo:
|
192 |
gr.Markdown(f"""
|
193 |
# Song Cover Image Generator
|
@@ -219,22 +215,14 @@ def ui():
|
|
219 |
)
|
220 |
with gr.Row():
|
221 |
run = gr.Button("Generate",elem_classes="btn")
|
|
|
|
|
|
|
|
|
|
|
222 |
with gr.Row():
|
223 |
cover = gr.Image(interactive=False,container=False,elem_classes="image-container", label="Result", show_label=True, type='filepath', show_share_button=False)
|
224 |
|
225 |
-
|
226 |
-
triggers=[
|
227 |
-
run.click
|
228 |
-
],
|
229 |
-
fn=handle_generate,
|
230 |
-
inputs=[artist,song,genre,lyrics],
|
231 |
-
outputs=[cover]
|
232 |
-
)
|
233 |
-
demo.queue().launch()
|
234 |
-
|
235 |
-
# entry
|
236 |
-
|
237 |
-
if __name__ == "__main__":
|
238 |
-
ui()
|
239 |
|
240 |
# end
|
|
|
20 |
import spaces
|
21 |
import torch
|
22 |
import gradio as gr
|
|
|
23 |
from lxml.html import fromstring
|
|
|
24 |
from huggingface_hub import hf_hub_download
|
25 |
from safetensors.torch import load_file, save_file
|
26 |
+
from diffusers import FluxPipeline
|
27 |
from PIL import Image, ImageDraw, ImageFont
|
28 |
|
29 |
# logging
|
|
|
46 |
|
47 |
base = "black-forest-labs/FLUX.1-schnell"
|
48 |
|
|
|
|
|
|
|
|
|
49 |
# precision data
|
50 |
|
51 |
seq=512
|
|
|
181 |
img.save(name)
|
182 |
return name
|
183 |
|
184 |
+
# entry
|
185 |
+
|
186 |
+
if __name__ == "__main__":
|
187 |
with gr.Blocks(theme=gr.themes.Citrus(),css=css,js=js) as demo:
|
188 |
gr.Markdown(f"""
|
189 |
# Song Cover Image Generator
|
|
|
215 |
)
|
216 |
with gr.Row():
|
217 |
run = gr.Button("Generate",elem_classes="btn")
|
218 |
+
run.click(
|
219 |
+
fn=handle_generate,
|
220 |
+
inputs=[artist,song,genre,lyrics],
|
221 |
+
outputs=[cover]
|
222 |
+
)
|
223 |
with gr.Row():
|
224 |
cover = gr.Image(interactive=False,container=False,elem_classes="image-container", label="Result", show_label=True, type='filepath', show_share_button=False)
|
225 |
|
226 |
+
demo.queue().launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
|
228 |
# end
|