Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -8,17 +8,6 @@ import uuid
|
|
8 |
from typing import Tuple
|
9 |
import numpy as np
|
10 |
|
11 |
-
DESCRIPTIONz = """## FLUX REALISM 🦁"""
|
12 |
-
|
13 |
-
|
14 |
-
DESCRIPTIONy = """
|
15 |
-
<p align="left">
|
16 |
-
<a title="Github" href="https://github.com/PRITHIVSAKTHIUR/FLUX-REALPIX" target="_blank" rel="noopener noreferrer" style="display: inline-block;">
|
17 |
-
<img src="https://img.shields.io/github/stars/PRITHIVSAKTHIUR/FLUX-REALPIX?label=GitHub%20%E2%98%85&logo=github&color=C8C" alt="badge-github-stars">
|
18 |
-
</a>
|
19 |
-
</p>
|
20 |
-
"""
|
21 |
-
|
22 |
def save_image(img):
|
23 |
unique_name = str(uuid.uuid4()) + ".png"
|
24 |
img.save(unique_name)
|
@@ -110,7 +99,7 @@ examples = [
|
|
110 |
]
|
111 |
|
112 |
css = '''
|
113 |
-
.gradio-container{max-width:
|
114 |
h1{text-align:center}
|
115 |
footer {
|
116 |
visibility: hidden
|
@@ -118,79 +107,80 @@ footer {
|
|
118 |
'''
|
119 |
|
120 |
with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
|
121 |
-
gr.Markdown(DESCRIPTIONz)
|
122 |
-
|
123 |
with gr.Row():
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
run_button = gr.Button("Run", scale=0)
|
132 |
-
result = gr.Gallery(label="Result", columns=1, show_label=False)
|
133 |
-
|
134 |
-
with gr.Accordion("Advanced options", open=False, visible=True):
|
135 |
-
seed = gr.Slider(
|
136 |
-
label="Seed",
|
137 |
-
minimum=0,
|
138 |
-
maximum=MAX_SEED,
|
139 |
-
step=1,
|
140 |
-
value=0,
|
141 |
-
visible=True
|
142 |
-
)
|
143 |
-
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
144 |
-
|
145 |
-
with gr.Row(visible=True):
|
146 |
-
width = gr.Slider(
|
147 |
-
label="Width",
|
148 |
-
minimum=512,
|
149 |
-
maximum=2048,
|
150 |
-
step=64,
|
151 |
-
value=1024,
|
152 |
-
)
|
153 |
-
height = gr.Slider(
|
154 |
-
label="Height",
|
155 |
-
minimum=512,
|
156 |
-
maximum=2048,
|
157 |
-
step=64,
|
158 |
-
value=1024,
|
159 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
|
161 |
-
with gr.
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
label="Number of inference steps",
|
171 |
-
minimum=1,
|
172 |
-
maximum=40,
|
173 |
-
step=1,
|
174 |
-
value=28,
|
175 |
)
|
176 |
|
177 |
-
style_selection = gr.Radio(
|
178 |
-
show_label=True,
|
179 |
-
container=True,
|
180 |
-
interactive=True,
|
181 |
-
choices=STYLE_NAMES,
|
182 |
-
value=DEFAULT_STYLE_NAME,
|
183 |
-
label="Quality Style",
|
184 |
-
)
|
185 |
-
|
186 |
-
gr.Examples(
|
187 |
-
examples=examples,
|
188 |
-
inputs=prompt,
|
189 |
-
outputs=[result, seed],
|
190 |
-
fn=generate,
|
191 |
-
cache_examples=False,
|
192 |
-
)
|
193 |
-
|
194 |
gr.on(
|
195 |
triggers=[
|
196 |
prompt.submit,
|
@@ -209,24 +199,6 @@ with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
|
|
209 |
outputs=[result, seed],
|
210 |
api_name="run",
|
211 |
)
|
212 |
-
|
213 |
-
gr.Markdown("**Disclaimer/Note:**")
|
214 |
-
|
215 |
-
gr.Markdown(DESCRIPTIONy)
|
216 |
-
|
217 |
-
#gr.Markdown("🔥This space provides realistic image generation, which works better for human faces and portraits. Realistic trigger works properly, better for photorealistic trigger words, close-up shots, face diffusion, male, female characters.")
|
218 |
-
|
219 |
-
#gr.Markdown("🔥users are accountable for the content they generate and are responsible for ensuring it meets appropriate ethical standards.")
|
220 |
-
|
221 |
-
gr.Markdown("""
|
222 |
-
<div style='text-align: justify;'>
|
223 |
-
🔥This space provides realistic image generation, which works better for human faces and portraits. Realistic trigger works properly, better for photorealistic trigger words, close-up shots, face diffusion, male, female characters.
|
224 |
-
</div>""")
|
225 |
-
|
226 |
-
gr.Markdown("""
|
227 |
-
<div style='text-align: justify;'>
|
228 |
-
🔥Users are accountable for the content they generate and are responsible for ensuring it meets appropriate ethical standards.
|
229 |
-
</div>""")
|
230 |
|
231 |
if __name__ == "__main__":
|
232 |
demo.queue(max_size=40).launch()
|
|
|
8 |
from typing import Tuple
|
9 |
import numpy as np
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
def save_image(img):
|
12 |
unique_name = str(uuid.uuid4()) + ".png"
|
13 |
img.save(unique_name)
|
|
|
99 |
]
|
100 |
|
101 |
css = '''
|
102 |
+
.gradio-container{max-width: 888px !important}
|
103 |
h1{text-align:center}
|
104 |
footer {
|
105 |
visibility: hidden
|
|
|
107 |
'''
|
108 |
|
109 |
with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
|
|
|
|
|
110 |
with gr.Row():
|
111 |
+
with gr.Column(scale=1):
|
112 |
+
prompt = gr.Text(
|
113 |
+
label="Prompt",
|
114 |
+
show_label=False,
|
115 |
+
max_lines=1,
|
116 |
+
placeholder="Enter your prompt",
|
117 |
+
container=False,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
)
|
119 |
+
run_button = gr.Button("Generate as ( 768 x 1024 )🤗", scale=0)
|
120 |
+
|
121 |
+
with gr.Accordion("Advanced options", open=True, visible=True):
|
122 |
+
seed = gr.Slider(
|
123 |
+
label="Seed",
|
124 |
+
minimum=0,
|
125 |
+
maximum=MAX_SEED,
|
126 |
+
step=1,
|
127 |
+
value=0,
|
128 |
+
visible=True
|
129 |
+
)
|
130 |
+
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
131 |
+
|
132 |
+
with gr.Row(visible=True):
|
133 |
+
width = gr.Slider(
|
134 |
+
label="Width",
|
135 |
+
minimum=512,
|
136 |
+
maximum=2048,
|
137 |
+
step=64,
|
138 |
+
value=768,
|
139 |
+
)
|
140 |
+
height = gr.Slider(
|
141 |
+
label="Height",
|
142 |
+
minimum=512,
|
143 |
+
maximum=2048,
|
144 |
+
step=64,
|
145 |
+
value=1024,
|
146 |
+
)
|
147 |
+
|
148 |
+
with gr.Row():
|
149 |
+
guidance_scale = gr.Slider(
|
150 |
+
label="Guidance Scale",
|
151 |
+
minimum=0.1,
|
152 |
+
maximum=20.0,
|
153 |
+
step=0.1,
|
154 |
+
value=3.0,
|
155 |
+
)
|
156 |
+
num_inference_steps = gr.Slider(
|
157 |
+
label="Number of inference steps",
|
158 |
+
minimum=1,
|
159 |
+
maximum=40,
|
160 |
+
step=1,
|
161 |
+
value=28,
|
162 |
+
)
|
163 |
+
|
164 |
+
style_selection = gr.Radio(
|
165 |
+
show_label=True,
|
166 |
+
container=True,
|
167 |
+
interactive=True,
|
168 |
+
choices=STYLE_NAMES,
|
169 |
+
value=DEFAULT_STYLE_NAME,
|
170 |
+
label="Quality Style",
|
171 |
+
)
|
172 |
|
173 |
+
with gr.Column(scale=2):
|
174 |
+
result = gr.Gallery(label="Result", columns=1, show_label=False)
|
175 |
+
|
176 |
+
gr.Examples(
|
177 |
+
examples=examples,
|
178 |
+
inputs=prompt,
|
179 |
+
outputs=[result, seed],
|
180 |
+
fn=generate,
|
181 |
+
cache_examples=False,
|
|
|
|
|
|
|
|
|
|
|
182 |
)
|
183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
gr.on(
|
185 |
triggers=[
|
186 |
prompt.submit,
|
|
|
199 |
outputs=[result, seed],
|
200 |
api_name="run",
|
201 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
|
203 |
if __name__ == "__main__":
|
204 |
demo.queue(max_size=40).launch()
|