phenomenon1981 commited on
Commit
82e5ae4
1 Parent(s): d304090

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +70 -48
app.py CHANGED
@@ -2,76 +2,98 @@ import gradio as gr
2
  import os
3
  import sys
4
  from pathlib import Path
 
 
5
 
6
  text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
7
 
8
- proc1=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0", preprocess=True, postprocess=False)
9
- proc2=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0", preprocess=True, postprocess=False)
10
- proc3=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0", preprocess=True, postprocess=False)
11
- proc4=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0", preprocess=True, postprocess=False)
12
- proc5=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0", preprocess=True, postprocess=False)
13
- proc6=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0", preprocess=True, postprocess=False)
14
- proc7=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0", preprocess=True, postprocess=False)
15
- proc8=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0", preprocess=True, postprocess=False)
16
-
17
- def send_it1(inputs, proc=proc1):
18
- output1=proc(inputs)
 
 
 
19
  return(output1)
20
- def send_it2(inputs, proc=proc2):
21
- output2=proc(inputs)
22
  return(output2)
23
- def send_it3(inputs, proc=proc3):
24
- output3=proc(inputs)
25
  return(output3)
26
- def send_it4(inputs, proc=proc4):
27
- output4=proc(inputs)
28
  return(output4)
29
- def send_it5(inputs, proc=proc5):
30
- output5=proc(inputs)
 
31
  return(output5)
32
- def send_it6(inputs, proc=proc6):
33
- output6=proc(inputs)
34
  return(output6)
35
- def send_it7(inputs, proc=proc7):
36
- output7=proc(inputs)
37
  return(output7)
38
- def send_it8(inputs, proc=proc8):
39
- output8=proc(inputs)
40
  return(output8)
41
 
 
42
  def get_prompts(prompt_text):
43
  return text_gen(prompt_text)
44
 
 
 
45
  with gr.Blocks() as myface:
46
  with gr.Row():
47
- input_text=gr.Textbox(label="Short Prompt")
48
- see_prompts=gr.Button("Magic Prompt")
 
 
49
  with gr.Row():
50
- prompt=gr.Textbox(label="Prettified Prompt")
51
- run=gr.Button("Launch")
52
-
53
 
 
 
 
 
54
  with gr.Row():
55
- output1=gr.Image(label="DreamlikeArt PhotoReal 1")
56
- output2=gr.Image(label="DreamlikeArt PhotoReal 2")
57
- output3=gr.Image(label="DreamlikeArt PhotoReal 3")
58
- output4=gr.Image(label="DreamlikeArt PhotoReal 4")
59
  with gr.Row():
60
- output5=gr.Image(label="DreamlikeArt Diffusion 1")
61
- output6=gr.Image(label="DreamlikeArt Diffusion 2")
62
- output7=gr.Image(label="DreamlikeArt Diffusion 3")
63
- output8=gr.Image(label="DreamlikeArt Diffusion 4")
64
-
 
 
 
 
 
 
 
 
 
65
  see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt])
66
-
67
- run.click(send_it1, inputs=[prompt], outputs=[output1], extra_args=[proc1])
68
- run.click(send_it2, inputs=[prompt], outputs=[output2], extra_args=[proc2])
69
- run.click(send_it3, inputs=[prompt], outputs=[output3], extra_args=[proc3])
70
- run.click(send_it4, inputs=[prompt], outputs=[output4], extra_args=[proc4])
71
- run.click(send_it5, inputs=[prompt], outputs=[output5], extra_args=[proc5])
72
- run.click(send_it6, inputs=[prompt], outputs=[output6], extra_args=[proc6])
73
- run.click(send_it7, inputs=[prompt], outputs=[output7], extra_args=[proc7])
74
- run.click(send_it8, inputs=[prompt], outputs=[output8], extra_args=[proc8])
 
75
 
76
  myface.queue(concurrency_count=8)
77
  myface.launch(enable_queue=True, inline=True)
 
2
  import os
3
  import sys
4
  from pathlib import Path
5
+ import random
6
+
7
 
8
  text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
9
 
10
+
11
+ proc1=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0", preprocess=True, postprocess=False, seed=random.randint(0,10000))
12
+ proc2=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0", preprocess=True, postprocess=False, seed=random.randint(0,10000))
13
+ proc3=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0", preprocess=True, postprocess=False, seed=random.randint(0,10000))
14
+ proc4=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0", preprocess=True, postprocess=False, seed=random.randint(0,10000))
15
+
16
+ proc5=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
17
+ proc6=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
18
+ proc7=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
19
+ proc8=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
20
+
21
+
22
+ def send_it1(inputs,proc1=proc1):
23
+ output1=proc1(inputs)
24
  return(output1)
25
+ def send_it2(inputs,proc2=proc2):
26
+ output2=proc2(inputs)
27
  return(output2)
28
+ def send_it3(inputs,proc3=proc3):
29
+ output3=proc3(inputs)
30
  return(output3)
31
+ def send_it4(inputs,proc4=proc4):
32
+ output4=proc4(inputs)
33
  return(output4)
34
+
35
+ def send_it5(inputs,proc5=proc5):
36
+ output5=proc5(inputs)
37
  return(output5)
38
+ def send_it6(inputs,proc6=proc6):
39
+ output6=proc6(inputs)
40
  return(output6)
41
+ def send_it7(inputs,proc7=proc7):
42
+ output7=proc7(inputs)
43
  return(output7)
44
+ def send_it8(inputs,proc8=proc8):
45
+ output8=proc8(inputs)
46
  return(output8)
47
 
48
+
49
  def get_prompts(prompt_text):
50
  return text_gen(prompt_text)
51
 
52
+
53
+
54
  with gr.Blocks() as myface:
55
  with gr.Row():
56
+
57
+
58
+ input_text=gr.Textbox(label="Short Prompt")
59
+ see_prompts=gr.Button("Magic Prompt")
60
  with gr.Row():
 
 
 
61
 
62
+ prompt=gr.Textbox(label="Prettified Prompt")
63
+ run=gr.Button("Launch")
64
+
65
+
66
  with gr.Row():
67
+ output1=gr.Image(label="DreamlikeArt PhotoReal 1")
68
+ output2=gr.Image(label="DreamlikeArt PhotoReal 2")
69
+ output3=gr.Image(label="DreamlikeArt PhotoReal 3")
70
+ output4=gr.Image(label="DreamlikeArt PhotoReal 4")
71
  with gr.Row():
72
+ output5=gr.Image(label="DreamlikeArt Diffusion 1")
73
+ output6=gr.Image(label="DreamlikeArt Diffusion 2")
74
+ output7=gr.Image(label="DreamlikeArt Diffusion 3")
75
+ output8=gr.Image(label="DreamlikeArt Diffusion 4")
76
+
77
+
78
+ #def set_models(model_name1, model_name2, model_name3, model_name4):
79
+
80
+ #return(proc1,proc2,proc3,proc4)
81
+
82
+ #run.click(set_models, inputs=[model_name1, model_name2, model_name3, model_name4], outputs=[proc1,proc2,proc3,proc4])
83
+ #run.click(send_it, inputs=[prompt], outputs=[output1, output2, output3, output4])
84
+
85
+
86
  see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt])
87
+
88
+ run.click(send_it1, inputs=[prompt], outputs=[output1])
89
+ run.click(send_it2, inputs=[prompt], outputs=[output2])
90
+ run.click(send_it3, inputs=[prompt], outputs=[output3])
91
+ run.click(send_it4, inputs=[prompt], outputs=[output4])
92
+ run.click(send_it5, inputs=[prompt], outputs=[output5])
93
+ run.click(send_it6, inputs=[prompt], outputs=[output6])
94
+ run.click(send_it7, inputs=[prompt], outputs=[output7])
95
+ run.click(send_it8, inputs=[prompt], outputs=[output8])
96
+
97
 
98
  myface.queue(concurrency_count=8)
99
  myface.launch(enable_queue=True, inline=True)