eeyorestoned Omnibus commited on
Commit
42a07ba
0 Parent(s):

Duplicate from Omnibus/maximum_diffusion

Browse files

Co-authored-by: Bot <Omnibus@users.noreply.huggingface.co>

Files changed (3) hide show
  1. .gitattributes +34 -0
  2. README.md +13 -0
  3. app.py +309 -0
.gitattributes ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tflite filter=lfs diff=lfs merge=lfs -text
29
+ *.tgz filter=lfs diff=lfs merge=lfs -text
30
+ *.wasm filter=lfs diff=lfs merge=lfs -text
31
+ *.xz filter=lfs diff=lfs merge=lfs -text
32
+ *.zip filter=lfs diff=lfs merge=lfs -text
33
+ *.zst filter=lfs diff=lfs merge=lfs -text
34
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Maximum Diffusion
3
+ emoji: 🛕
4
+ colorFrom: red
5
+ colorTo: blue
6
+ sdk: gradio
7
+ sdk_version: 3.15.0
8
+ app_file: app.py
9
+ pinned: true
10
+ duplicated_from: Omnibus/maximum_diffusion
11
+ ---
12
+
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,309 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
3
+ import sys
4
+ from pathlib import Path
5
+ import time
6
+
7
+
8
+ text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion",live=True, preprocess=True)
9
+
10
+
11
+ proc1=gr.Interface.load("models/nitrosocke/Arcane-Diffusion", live=True, preprocess=True, postprocess=False)
12
+ proc2=gr.Interface.load("models/naclbit/trinart_stable_diffusion_v2", live=True, preprocess=True, postprocess=False)
13
+ proc3=gr.Interface.load("models/nitrosocke/redshift-diffusion", live=True, preprocess=True, postprocess=False)
14
+ proc4=gr.Interface.load("models/runwayml/stable-diffusion-v1-5", live=True, preprocess=True, postprocess=False)
15
+
16
+ proc5=gr.Interface.load("models/claudfuen/photorealistic-fuen-v1", live=True, preprocess=True, postprocess=False)
17
+ proc6=gr.Interface.load("models/CompVis/stable-diffusion-v1-4", live=True, preprocess=True, postprocess=False)
18
+ proc7=gr.Interface.load("models/Linaqruf/anything-v3.0", live=True, preprocess=True, postprocess=False)
19
+ proc8=gr.Interface.load("models/andite/anything-v4.0", live=True, preprocess=True, postprocess=False)
20
+
21
+ proc9=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-1.0", live=True, preprocess=True, postprocess=False)
22
+ proc10=gr.Interface.load("models/prompthero/openjourney", live=True, preprocess=True, postprocess=False)
23
+ proc11=gr.Interface.load("models/prompthero/midjourney-v4-diffusion", live=True, preprocess=True, postprocess=False)
24
+ proc12=gr.Interface.load("models/wavymulder/Analog-Diffusion", live=True, preprocess=True, postprocess=False)
25
+
26
+
27
+ #proc13=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0")
28
+ #proc14=gr.Interface.load("models/wavymulder/Analog-Diffusion")
29
+ #proc15=gr.Interface.load("models/nitrosocke/redshift-diffusion")
30
+ #proc16=gr.Interface.load("models/prompthero/midjourney-v4-diffusion")
31
+
32
+ def get_prompts(prompt_text):
33
+ return text_gen(prompt_text)
34
+ def send_it1(inputs,proc1=proc1):
35
+ output1=proc1(inputs)
36
+ return(output1)
37
+ def send_it2(inputs,proc2=proc2):
38
+ output2=proc2(inputs)
39
+ return(output2)
40
+ def send_it3(inputs,proc3=proc3):
41
+ output3=proc3(inputs)
42
+ return(output3)
43
+ def send_it4(inputs,proc4=proc4):
44
+ output4=proc4(inputs)
45
+ return(output4)
46
+
47
+ def send_it5(inputs,proc5=proc5):
48
+ output5=proc5(inputs)
49
+ return(output5)
50
+ def send_it6(inputs,proc6=proc6):
51
+ output6=proc6(inputs)
52
+ return(output6)
53
+ def send_it7(inputs,proc7=proc7):
54
+ output7=proc7(inputs)
55
+ return(output7)
56
+ def send_it8(inputs,proc8=proc8):
57
+ output8=proc8(inputs)
58
+ return(output8)
59
+
60
+ def send_it9(inputs,proc9=proc9):
61
+ output9=proc9(inputs)
62
+ return(output9)
63
+ def send_it10(inputs,proc10=proc10):
64
+ output10=proc10(inputs)
65
+ return(output10)
66
+ def send_it11(inputs,proc11=proc11):
67
+ output11=proc11(inputs)
68
+ return(output11)
69
+ def send_it12(inputs,proc12=proc12):
70
+ output12=proc12(inputs)
71
+ return(output12)
72
+
73
+ #def send_it13(inputs,proc13=proc13):
74
+ # output13=proc13(inputs)
75
+ # return(output13)
76
+ #def send_it14(inputs,proc14=proc14):
77
+ # output14=proc14(inputs)
78
+ # return(output14)
79
+ #def send_it15(inputs,proc15=proc15):
80
+ # output15=proc15(inputs)
81
+ # return(output15)
82
+ #def send_it16(inputs,proc16=proc16):
83
+ # output16=proc16(inputs)
84
+ # return(output16)
85
+
86
+
87
+ def main():
88
+ #test = 0
89
+
90
+
91
+
92
+ #batch=True, max_batch_size=30
93
+ #max_batch_size=20
94
+ with gr.Blocks(batch=True,max_batch_size=800) as myface:
95
+ with gr.Row():
96
+ with gr.Tab("Title"):
97
+ gr.HTML(""" <title>Maximum Diffusion</title><div style="text-align: center; max-width: 1500px; margin: 0 auto;">
98
+ <div
99
+ style="
100
+ display: inline-flex;
101
+ align-items: center;
102
+ gap: 0.8rem;
103
+ font-size: 1.75rem;
104
+ margin-bottom: 10px;
105
+ line-height: 1em;
106
+ "
107
+ >
108
+ <h1 style="font-weight: 1200; margin-top: 9px;">
109
+ Maximum Diffusion
110
+ </h1>
111
+ </div>
112
+ <br>
113
+ <br>
114
+ <p style="margin-bottom: 10px;font-size: 94%;font-weight: 100;line-height: 1.5em;">
115
+ Text to Image Model Comparison Space - CPU
116
+ </p><br><br>
117
+ <p style="margin-bottom: 10px;font-size: 94%;font-weight: 100;line-height: 1.5em;">
118
+ Freaky Fast, when it's fresh<br>
119
+ Try a Mirror, or DIY for Maximum Diffusion in minimum time.
120
+ </p><br>
121
+
122
+
123
+ </div>
124
+ """)
125
+
126
+
127
+
128
+ with gr.Tab("Description"):
129
+ gr.HTML("""<div style="text-align:center;">
130
+ <h4>Enter your Prompt into the "Short Prompt" box and click "Magic Prompt" to load a prettified version of your prompt<br>
131
+ When you are satisfied with the prompt that is in the "Text to Image" box, click "Launch" to load the Models.<br><br>
132
+ Images load faster with a simpler prompt.<br>
133
+ Most images should load within 2 minutes.<br>
134
+ Some models become stuck on certain prompts, and refreshing the page seems to fix it.<br><br>
135
+ Not responsible for content, use at your own risk.
136
+
137
+ </h4>
138
+ </div>""")
139
+ with gr.Tab("DIY"):
140
+ gr.HTML("""<div style="text-align:Left;">
141
+ <h4>Copy/Paste this code in your app.py file<br><br>
142
+
143
+ import gradio as gr<br>
144
+ max_d=gr.Interface.load("spaces/Omnibus/maximum_diffusion")<br>
145
+ max_d.launch()<br>
146
+ </h4>
147
+ </div>""")
148
+
149
+ with gr.Tab("Mirrors"):
150
+ gr.HTML("""<div style="text-align:center;vertical-align:center;">
151
+ <h4>Queue loading slow? Try a Mirror:<br><br>
152
+ <a href="https://huggingface.co/spaces/Omnibus/maximum-diffusion-light">Maximum Diffusion Light 1</a><br>
153
+ <p><a href="https://huggingface.co/spaces/Omnibus/maximum-diffusion-light-1">Maximum Diffusion Light 2</a><br>
154
+ <p><a href="https://huggingface.co/spaces/Omnibus/maximum-diffusion-light-2">Maximum Diffusion Light 3</a>
155
+
156
+
157
+ </h4>
158
+ </div>""")
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+ with gr.Tab("Credits"):
167
+ with gr.Row():
168
+ gr.Column()
169
+ with gr.Column(style="text-align:left;"):
170
+ gr.HTML("""
171
+ <div style="vertical-align:center">
172
+ <br>
173
+ <p>I learned everything I know from:
174
+ <p><a href="https://huggingface.co/spaces/anzorq/finetuned_diffusion">Finetuned Diffusion</a></p>
175
+ <p><a href="https://huggingface.co/spaces/Gustavosta/MagicPrompt-Stable-Diffusion">Magic Prompt Stable Diffusion</a></p>
176
+ <p><a href="https://huggingface.co/spaces/huggingface-projects/magic-diffusion">Magic Diffusion</a></p>
177
+
178
+ <p>Models by <a href="https://huggingface.co/Gustavosta">@Gustavosta</a>, <a href="https://twitter.com/haruu1367">@haruu1367</a>, <a href="https://twitter.com/DGSpitzer">@Helixngc7293</a>, <a href="https://twitter.com/dal_mack">@dal_mack</a>, <a href="https://twitter.com/prompthero">@prompthero</a> and others.</p>
179
+ </div>
180
+ """)
181
+ gr.Column()
182
+
183
+
184
+ with gr.Tab("Tools"):
185
+ with gr.Tab("View"):
186
+ with gr.Column(style="width=50%, height=70%"):
187
+ gr.Pil(label="Crop")
188
+ with gr.Column(style="width=50%, height=70%"):
189
+ gr.Pil(label="Crop")
190
+
191
+
192
+ with gr.Tab("Draw"):
193
+ with gr.Column(style="width=50%, height=70%"):
194
+ gr.Pil(label="Crop")
195
+ with gr.Column(style="width=50%, height=70%"):
196
+ gr.Pil(label="Draw")
197
+
198
+
199
+ gr.ImagePaint(label="Draw")
200
+
201
+ with gr.Tab("Text"):
202
+ with gr.Row():
203
+
204
+ with gr.Column(scale=50):
205
+ gr.Textbox(label="", lines=8, interactive=True)
206
+
207
+
208
+ with gr.Column(scale=50):
209
+ gr.Textbox(label="", lines=8, interactive=True)
210
+
211
+ with gr.Tab("Color Picker"):
212
+ with gr.Row():
213
+
214
+ with gr.Column(scale=50):
215
+ gr.ColorPicker(label="Color", interactive=True)
216
+
217
+
218
+ with gr.Column(scale=50):
219
+ gr.ImagePaint(label="Draw", interactive=True)
220
+
221
+
222
+
223
+ with gr.Row():
224
+
225
+
226
+ input_text=gr.Textbox(label="Short Prompt")
227
+ see_prompts=gr.Button("Magic Prompt")
228
+ with gr.Row():
229
+
230
+ prompt=gr.Textbox(label="Text to Image")
231
+ run=gr.Button("Launch")
232
+
233
+ # with gr.Row():
234
+ # gr.Column()
235
+ # with gr.Column():
236
+ # clear_btn=gr.Button("Test")
237
+
238
+
239
+ with gr.Row():
240
+ output2=gr.Image(label="naclbit/trinart_stable_diffusion_v2")
241
+ output11=gr.Image(label="prompthero/midjourney-v4-diffusion")
242
+
243
+ output3=gr.Image(label="nitrosocke/redshift-diffusion")
244
+ output4=gr.Image(label="runwayml/stable-diffusion-v1-5")
245
+ with gr.Row():
246
+ output5=gr.Image(label="claudfuen/photorealistic-fuen-v1")
247
+ output6=gr.Image(label="CompVis/stable-diffusion-v1-4")
248
+
249
+ output7=gr.Image(label="Linaqruf/anything-v3.0")
250
+ output8=gr.Image(label="andite/anything-v4.0")
251
+
252
+ with gr.Row():
253
+ output9=gr.Image(label="dreamlike-art/dreamlike-photoreal-1.0")
254
+ output10=gr.Image(label="prompthero/openjourney")
255
+ output1=gr.Image(label="nitrosocke/Arcane-Diffusion")
256
+
257
+ output12=gr.Image(label="wavymulder/Analog-Diffusion")
258
+
259
+
260
+ #with gr.Row():
261
+ # output13=gr.Image(label="dreamlike-photoreal-2.0")
262
+ # output14=gr.Image(label="Analog-Diffusion")
263
+ #
264
+ # output15=gr.Image(label="redshift-diffusion")
265
+ # output16=gr.Image(label="midjourney-v4-diffusion")
266
+
267
+
268
+
269
+ #def set_models(model_name1, model_name2, model_name3, model_name4):
270
+
271
+ #return(proc1,proc2,proc3,proc4)
272
+
273
+ #run.click(set_models, inputs=[model_name1, model_name2, model_name3, model_name4], outputs=[proc1,proc2,proc3,proc4])
274
+ #run.click(send_it, inputs=[prompt], outputs=[output1, output2, output3, output4])
275
+
276
+ def clear_queue():
277
+
278
+ myface.queue.clear()
279
+
280
+ #clear_btn.click(clear_queue, inputs=None, outputs=None)
281
+ see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt])
282
+ #timeout = time.time() + 5 #60*1 #1 minute # 5 minutes from now
283
+
284
+ run.click(send_it1, inputs=[prompt], outputs=[output1])
285
+ run.click(send_it2, inputs=[prompt], outputs=[output2])
286
+ run.click(send_it3, inputs=[prompt], outputs=[output3])
287
+ run.click(send_it4, inputs=[prompt], outputs=[output4])
288
+ run.click(send_it5, inputs=[prompt], outputs=[output5])
289
+ run.click(send_it6, inputs=[prompt], outputs=[output6])
290
+ run.click(send_it7, inputs=[prompt], outputs=[output7])
291
+ run.click(send_it8, inputs=[prompt], outputs=[output8])
292
+ run.click(send_it9, inputs=[prompt], outputs=[output9])
293
+ run.click(send_it10, inputs=[prompt], outputs=[output10])
294
+ run.click(send_it11, inputs=[prompt], outputs=[output11])
295
+ run.click(send_it12, inputs=[prompt], outputs=[output12])
296
+ #run.click(send_it13, inputs=[prompt], outputs=[output13])
297
+ #run.click(send_it14, inputs=[prompt], outputs=[output14])
298
+ #run.click(send_it15, inputs=[prompt], outputs=[output15])
299
+ #run.click(send_it16, inputs=[prompt], outputs=[output16])
300
+
301
+ #myface.queue(default_enabled=False)
302
+ #myface.queue(concurrency_count=240,status_update_rate=1)
303
+ myface.queue(concurrency_count=800,status_update_rate=1)
304
+ myface.launch(enable_queue=True,inline=True,max_threads=800)
305
+
306
+ #myface.launch(enable_queue=True, max_threads=20)
307
+ if __name__ == "__main__":
308
+ main()
309
+