phenomenon1981 commited on
Commit
d304090
1 Parent(s): b6aa81d

Update app.py

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