Spaces:
Running
on
Zero
Running
on
Zero
Upload folder using huggingface_hub
Browse files- README.md +6 -5
- app.py +57 -0
- requirements.txt +4 -0
README.md
CHANGED
@@ -1,12 +1,13 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
colorFrom: green
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 4.
|
8 |
app_file: app.py
|
9 |
pinned: false
|
|
|
10 |
---
|
11 |
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: FLUX 1 DEV
|
3 |
+
emoji: 🎨
|
4 |
colorFrom: green
|
5 |
+
colorTo: yellow
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 4.36.1
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
+
license: apache-2.0
|
11 |
---
|
12 |
|
13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import spaces
|
3 |
+
from panna import Flux1Dev
|
4 |
+
|
5 |
+
|
6 |
+
model = Flux1Dev()
|
7 |
+
title = ("# [Flux 1 Dev](https://huggingface.co/black-forest-labs/FLUX.1-dev)\n"
|
8 |
+
"The demo is part of [panna](https://github.com/asahi417/panna) project.")
|
9 |
+
examples = [
|
10 |
+
"Astronaut in a jungle, cold color palette, muted colors, detailed, 8k",
|
11 |
+
"A female model, high quality, fashion, Paris, Vogue, Maison Margiela, 8k",
|
12 |
+
]
|
13 |
+
css = """
|
14 |
+
#col-container {
|
15 |
+
margin: 0 auto;
|
16 |
+
max-width: 580px;
|
17 |
+
}
|
18 |
+
"""
|
19 |
+
|
20 |
+
|
21 |
+
@spaces.GPU
|
22 |
+
def infer(prompt, negative_prompt, seed, width, height, guidance_scale, num_inference_steps):
|
23 |
+
return model.text2image(
|
24 |
+
prompt=[prompt],
|
25 |
+
negative_prompt=[negative_prompt],
|
26 |
+
guidance_scale=guidance_scale,
|
27 |
+
num_inference_steps=num_inference_steps,
|
28 |
+
width=width,
|
29 |
+
height=height,
|
30 |
+
seed=seed
|
31 |
+
)[0]
|
32 |
+
|
33 |
+
|
34 |
+
with gr.Blocks(css=css) as demo:
|
35 |
+
with gr.Column(elem_id="col-container"):
|
36 |
+
gr.Markdown(title)
|
37 |
+
with gr.Row():
|
38 |
+
prompt = gr.Text(label="Prompt", show_label=False, max_lines=1, placeholder="Enter your prompt", container=False)
|
39 |
+
run_button = gr.Button("Run", scale=0)
|
40 |
+
result = gr.Image(label="Result", show_label=False)
|
41 |
+
with gr.Accordion("Advanced Settings", open=False):
|
42 |
+
negative_prompt = gr.Text(label="Negative Prompt", max_lines=1, placeholder="Enter a negative prompt")
|
43 |
+
seed = gr.Slider(label="Seed", minimum=0, maximum=1_000_000, step=1, value=0)
|
44 |
+
with gr.Row():
|
45 |
+
width = gr.Slider(label="Width", minimum=256, maximum=1344, step=64, value=1024)
|
46 |
+
height = gr.Slider(label="Height", minimum=256, maximum=1344, step=64, value=1024)
|
47 |
+
with gr.Row():
|
48 |
+
guidance_scale = gr.Slider(label="Guidance scale", minimum=0.0, maximum=10.0, step=0.1, value=3.5)
|
49 |
+
num_inference_steps = gr.Slider(label="Inference steps", minimum=1, maximum=50, step=1, value=50)
|
50 |
+
gr.Examples(examples=examples, inputs=[prompt])
|
51 |
+
gr.on(
|
52 |
+
triggers=[run_button.click, prompt.submit, negative_prompt.submit],
|
53 |
+
fn=infer,
|
54 |
+
inputs=[prompt, negative_prompt, seed, width, height, guidance_scale, num_inference_steps],
|
55 |
+
outputs=[result]
|
56 |
+
)
|
57 |
+
demo.launch(server_name="0.0.0.0")
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
git+https://github.com/huggingface/diffusers.git
|
2 |
+
accelerate
|
3 |
+
sentencepiece
|
4 |
+
panna>=0.0.4
|