phenomenon1981 commited on
Commit
68ce975
1 Parent(s): 717fefc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +98 -5
app.py CHANGED
@@ -1,7 +1,100 @@
1
  import gradio as gr
 
 
 
2
 
3
- model1 = gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0")
4
- model2 = gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
5
- models_list = [model1, model2]
6
- selected_model = gr.selector(models_list, label="Select model")
7
- selected_model.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ 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-diffusion-1.0")
12
+ proc3=gr.Interface.load("models/nitrosocke/redshift-diffusion")
13
+ proc4=gr.Interface.load("models/prompthero/midjourney-v4-diffusion")
14
+
15
+ proc5=gr.Interface.load("models/nitrosocke/Arcane-Diffusion")
16
+ proc6=gr.Interface.load("models/naclbit/trinart_stable_diffusion_v2")
17
+ proc7=gr.Interface.load("models/DGSpitzer/Cyberpunk-Anime-Diffusion")
18
+ proc8=gr.Interface.load("models/stabilityai/stable-diffusion-2-1")
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
+ output4=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()
67
+ output2=gr.Image()
68
+
69
+ output3=gr.Image()
70
+ output4=gr.Image()
71
+ with gr.Row():
72
+ output5=gr.Image()
73
+ output6=gr.Image()
74
+
75
+ output7=gr.Image()
76
+ output8=gr.Image()
77
+
78
+
79
+ #def set_models(model_name1, model_name2, model_name3, model_name4):
80
+
81
+ #return(proc1,proc2,proc3,proc4)
82
+
83
+ #run.click(set_models, inputs=[model_name1, model_name2, model_name3, model_name4], outputs=[proc1,proc2,proc3,proc4])
84
+ #run.click(send_it, inputs=[prompt], outputs=[output1, output2, output3, output4])
85
+
86
+
87
+ see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt])
88
+
89
+ run.click(send_it1, inputs=[prompt], outputs=[output1])
90
+ run.click(send_it2, inputs=[prompt], outputs=[output2])
91
+ run.click(send_it3, inputs=[prompt], outputs=[output3])
92
+ run.click(send_it4, inputs=[prompt], outputs=[output4])
93
+ run.click(send_it5, inputs=[prompt], outputs=[output5])
94
+ run.click(send_it6, inputs=[prompt], outputs=[output6])
95
+ run.click(send_it7, inputs=[prompt], outputs=[output7])
96
+ run.click(send_it8, inputs=[prompt], outputs=[output8])
97
+
98
+
99
+ myface.queue(concurrency_count=8)
100
+ myface.launch(enable_queue=True, inline=True)