Spaces:
Runtime error
Runtime error
nroggendorff
commited on
Commit
•
1774837
1
Parent(s):
8f3c856
Update app.py
Browse files
app.py
CHANGED
@@ -4,43 +4,36 @@ import random
|
|
4 |
|
5 |
import torch
|
6 |
from diffusers import FluxPipeline
|
7 |
-
from huggingface_hub.utils import RepositoryNotFoundError
|
8 |
|
9 |
pipeline = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.float16)
|
10 |
pipeline.load_lora_weights("pepper13/fluxfw")
|
11 |
-
pipeline.to("cuda")
|
12 |
-
|
13 |
-
with open("main.css", "r") as css:
|
14 |
-
link = css
|
15 |
|
16 |
@spaces.GPU(duration=70)
|
17 |
def generate(prompt):
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
height=512,
|
22 |
-
num_inference_steps=20,
|
23 |
-
guidance_scale=7
|
24 |
-
).images[0]
|
25 |
|
26 |
-
with
|
27 |
-
with gr.
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
44 |
|
45 |
if __name__ == "__main__":
|
46 |
interface.launch()
|
|
|
4 |
|
5 |
import torch
|
6 |
from diffusers import FluxPipeline
|
|
|
7 |
|
8 |
pipeline = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.float16)
|
9 |
pipeline.load_lora_weights("pepper13/fluxfw")
|
10 |
+
# pipeline.to("cuda")
|
|
|
|
|
|
|
11 |
|
12 |
@spaces.GPU(duration=70)
|
13 |
def generate(prompt):
|
14 |
+
pipe_end = pipeline(prompt=prompt, width=512, height=512, num_inference_steps=24, guidance_scale=7)
|
15 |
+
image = pipe_end.images[0]
|
16 |
+
return image
|
|
|
|
|
|
|
|
|
17 |
|
18 |
+
with open("main.css", "r") as link:
|
19 |
+
with gr.Blocks(css=link) as interface:
|
20 |
+
with gr.Column(elem_classes="interface-container"):
|
21 |
+
prompt = gr.Textbox(
|
22 |
+
label="Prompt",
|
23 |
+
info="Describe the image you want to generate.",
|
24 |
+
placeholder="e.g., Keanu Reeves holding a neon sign reading 'Hello, world!', 32k HDR, paparazzi",
|
25 |
+
# lines=1,
|
26 |
+
elem_classes="text-box"
|
27 |
+
)
|
28 |
+
|
29 |
+
generate_button = gr.Button("Generate Image", elem_classes="btn")
|
30 |
+
output = gr.Image(elem_classes="image-output")
|
31 |
+
|
32 |
+
generate_button.click(
|
33 |
+
fn=generate,
|
34 |
+
inputs=[prompt],
|
35 |
+
outputs=[output]
|
36 |
+
)
|
37 |
|
38 |
if __name__ == "__main__":
|
39 |
interface.launch()
|