Omnibus commited on
Commit
57bed7e
·
1 Parent(s): 223e7ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +94 -96
app.py CHANGED
@@ -70,108 +70,106 @@ def send_it1(inputs,model_choice, count = 1):
70
  proc1=models2[model_choice]
71
  output1=proc1(inputs)
72
  output_list.append(output1)
 
73
  t+=1
74
  return(output_list)
75
 
76
- def emb():
77
- with gr.Blocks(css="cake.css") as myface:
78
- gr.HTML("""<head><meta http-equiv="refresh" content="180"></head>""")
79
-
80
-
81
-
82
-
83
-
84
-
85
- gr.HTML("""<title>Top 20 Diffuion</title>""")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  with gr.Column():
87
- gr.Markdown("""<center><h1>Top 20 Diffusion</h1><center>""")
88
- with gr.Accordion("Details",open=False):
89
- with gr.Tab("Description"):
90
- gr.Markdown("""<center>
91
- <h6>Enter your Prompt into the "Short Prompt" box and click "Magic Prompt" to load a prettified version of your prompt<br>
92
- When you are satisfied with the prompt that is in the "Text to Image" box, click "Launch" to load the Models.<br><br>
93
- Images load faster with a simpler prompt.<br>
94
- <br>
95
- Images will cancel loading after 1 minute to preserve the quality of the queue.<br>
96
- Simply Click "Launch" again to try loading the incomplete images.<br>
97
- Page refreshes every 3 minutes for this Demo.
98
- <br>
99
- <br>
100
- Not responsible for content, use at your own risk.
101
- </h6></center>""")
102
- with gr.Tab("DIY"):
103
- gr.HTML("""<div style="text-align:Left;">
104
- <h6>Easy Clone:<br><br>
105
- Copy/Paste this code in your new app.py file<br><br>
106
- import gradio as gr<br>
107
- max_d=gr.Interface.load("spaces/Omnibus/Top-20-Diffusion")<br>
108
- max_d.launch()<br>
109
- </h6></div>""")
110
- with gr.Tab("Credits"):
111
- with gr.Row():
112
- with gr.Column(style="text-align:left;"):
113
- gr.HTML("""
114
- <div style="vertical-align:center">
115
- <br>
116
- <p>Magic Prompt:
117
- <p><a href="https://huggingface.co/spaces/Gustavosta/MagicPrompt-Stable-Diffusion">Magic Prompt Stable Diffusion</a></p>
118
- <p><a href="https://huggingface.co/spaces/huggingface-projects/magic-diffusion">Magic Diffusion</a></p>
119
- </div>
120
- """)
121
- with gr.Column(style="text-align:left;"):
122
- gr.HTML(f"""
123
- <div style="vertical-align:center">
124
- <br>
125
- <p>Models by:<br>
126
- <a href="https://huggingface.co/{models[1]}">{models[1]}</a><br>
127
- <a href="https://huggingface.co/{models[2]}">{models[2]}</a><br>
128
- <a href="https://huggingface.co/{models[3]}">{models[3]}</a><br>
129
- <a href="https://huggingface.co/{models[4]}">{models[4]}</a><br>
130
- <a href="https://huggingface.co/{models[5]}">{models[5]}</a><br>
131
- <a href="https://huggingface.co/{models[6]}">{models[6]}</a><br>
132
- <a href="https://huggingface.co/{models[7]}">{models[7]}</a><br>
133
- <a href="https://huggingface.co/{models[8]}">{models[8]}</a><br>
134
- <a href="https://huggingface.co/{models[9]}">{models[9]}</a><br>
135
- <a href="https://huggingface.co/{models[10]}">{models[10]}</a><br>
136
- <a href="https://huggingface.co/{models[11]}">{models[11]}</a><br>
137
- <a href="https://huggingface.co/{models[12]}">{models[12]}</a><br>
138
- <a href="https://huggingface.co/{models[13]}">{models[13]}</a><br>
139
- <a href="https://huggingface.co/{models[14]}">{models[14]}</a><br>
140
- <a href="https://huggingface.co/{models[15]}">{models[15]}</a><br>
141
- <a href="https://huggingface.co/{models[16]}">{models[16]}</a><br>
142
- <a href="https://huggingface.co/{models[17]}">{models[17]}</a><br>
143
- <a href="https://huggingface.co/{models[18]}">{models[18]}</a><br>
144
- <a href="https://huggingface.co/{models[19]}">{models[19]}</a><br>
145
- <a href="https://huggingface.co/{models[20]}">{models[20]}</a><br>
146
- </p>
147
- </div>
148
- """)
149
 
 
150
  with gr.Row():
151
- with gr.Column():
152
- input_text=gr.Textbox(label="Short Prompt")
153
- prompt=gr.Textbox(label="Text to Image Prompt",visible=True)
154
- model_name1 = gr.Dropdown(show_label=False, choices=[m for m in models], type="index", value=current_model, interactive=True)
155
- count = gr.Number(value=1)
156
- with gr.Column():
157
- see_prompts=gr.Button("Magic Prompt")
158
- with gr.Row():
159
- run=gr.Button("Launch")
160
- clear_btn=gr.Button("Clear")
161
-
162
- with gr.Column(visible=True) as timo:
163
- with gr.Row():
164
- output1=gr.Gallery()
165
 
166
- def get_prompts(prompt_text):
167
 
168
- gen=text_gen(prompt_text)
169
- return gen
170
-
171
-
172
- run1=run.click(send_it1, inputs=[prompt, model_name1,count], outputs=[output1])
173
 
174
- myface.queue(concurrency_count=400,status_update_rate=1)
175
- myface.launch(inline=True,show_api=False)
176
- if __name__ == "__main__":
177
- emb()
 
70
  proc1=models2[model_choice]
71
  output1=proc1(inputs)
72
  output_list.append(output1)
73
+ inputs=f"{inputs} "
74
  t+=1
75
  return(output_list)
76
 
77
+ with gr.Blocks(css="cake.css") as myface:
78
+ gr.HTML("""<head><meta http-equiv="refresh" content="180"></head>""")
79
+
80
+
81
+
82
+
83
+
84
+
85
+ gr.HTML("""<title>Top 20 Diffuion</title>""")
86
+ with gr.Column():
87
+ gr.Markdown("""<center><h1>Top 20 Diffusion</h1><center>""")
88
+ with gr.Accordion("Details",open=False):
89
+ with gr.Tab("Description"):
90
+ gr.Markdown("""<center>
91
+ <h6>Enter your Prompt into the "Short Prompt" box and click "Magic Prompt" to load a prettified version of your prompt<br>
92
+ When you are satisfied with the prompt that is in the "Text to Image" box, click "Launch" to load the Models.<br><br>
93
+ Images load faster with a simpler prompt.<br>
94
+ <br>
95
+ Images will cancel loading after 1 minute to preserve the quality of the queue.<br>
96
+ Simply Click "Launch" again to try loading the incomplete images.<br>
97
+ Page refreshes every 3 minutes for this Demo.
98
+ <br>
99
+ <br>
100
+ Not responsible for content, use at your own risk.
101
+ </h6></center>""")
102
+ with gr.Tab("DIY"):
103
+ gr.HTML("""<div style="text-align:Left;">
104
+ <h6>Easy Clone:<br><br>
105
+ Copy/Paste this code in your new app.py file<br><br>
106
+ import gradio as gr<br>
107
+ max_d=gr.Interface.load("spaces/Omnibus/Top-20-Diffusion")<br>
108
+ max_d.launch()<br>
109
+ </h6></div>""")
110
+ with gr.Tab("Credits"):
111
+ with gr.Row():
112
+ with gr.Column(style="text-align:left;"):
113
+ gr.HTML("""
114
+ <div style="vertical-align:center">
115
+ <br>
116
+ <p>Magic Prompt:
117
+ <p><a href="https://huggingface.co/spaces/Gustavosta/MagicPrompt-Stable-Diffusion">Magic Prompt Stable Diffusion</a></p>
118
+ <p><a href="https://huggingface.co/spaces/huggingface-projects/magic-diffusion">Magic Diffusion</a></p>
119
+ </div>
120
+ """)
121
+ with gr.Column(style="text-align:left;"):
122
+ gr.HTML(f"""
123
+ <div style="vertical-align:center">
124
+ <br>
125
+ <p>Models by:<br>
126
+ <a href="https://huggingface.co/{models[1]}">{models[1]}</a><br>
127
+ <a href="https://huggingface.co/{models[2]}">{models[2]}</a><br>
128
+ <a href="https://huggingface.co/{models[3]}">{models[3]}</a><br>
129
+ <a href="https://huggingface.co/{models[4]}">{models[4]}</a><br>
130
+ <a href="https://huggingface.co/{models[5]}">{models[5]}</a><br>
131
+ <a href="https://huggingface.co/{models[6]}">{models[6]}</a><br>
132
+ <a href="https://huggingface.co/{models[7]}">{models[7]}</a><br>
133
+ <a href="https://huggingface.co/{models[8]}">{models[8]}</a><br>
134
+ <a href="https://huggingface.co/{models[9]}">{models[9]}</a><br>
135
+ <a href="https://huggingface.co/{models[10]}">{models[10]}</a><br>
136
+ <a href="https://huggingface.co/{models[11]}">{models[11]}</a><br>
137
+ <a href="https://huggingface.co/{models[12]}">{models[12]}</a><br>
138
+ <a href="https://huggingface.co/{models[13]}">{models[13]}</a><br>
139
+ <a href="https://huggingface.co/{models[14]}">{models[14]}</a><br>
140
+ <a href="https://huggingface.co/{models[15]}">{models[15]}</a><br>
141
+ <a href="https://huggingface.co/{models[16]}">{models[16]}</a><br>
142
+ <a href="https://huggingface.co/{models[17]}">{models[17]}</a><br>
143
+ <a href="https://huggingface.co/{models[18]}">{models[18]}</a><br>
144
+ <a href="https://huggingface.co/{models[19]}">{models[19]}</a><br>
145
+ <a href="https://huggingface.co/{models[20]}">{models[20]}</a><br>
146
+ </p>
147
+ </div>
148
+ """)
149
+
150
+ with gr.Row():
151
+ with gr.Column():
152
+ input_text=gr.Textbox(label="Short Prompt")
153
+ prompt=gr.Textbox(label="Text to Image Prompt",visible=True)
154
+ model_name1 = gr.Dropdown(show_label=False, choices=[m for m in models], type="index", value=current_model, interactive=True)
155
+ count = gr.Number(value=1)
156
  with gr.Column():
157
+ see_prompts=gr.Button("Magic Prompt")
158
+ with gr.Row():
159
+ run=gr.Button("Launch")
160
+ clear_btn=gr.Button("Clear")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
 
162
+ with gr.Column(visible=True) as timo:
163
  with gr.Row():
164
+ output1=gr.Gallery(columns=2)
 
 
 
 
 
 
 
 
 
 
 
 
 
165
 
166
+ def get_prompts(prompt_text):
167
 
168
+ gen=text_gen(prompt_text)
169
+ return gen
170
+
171
+
172
+ run1=run.click(send_it1, inputs=[prompt, model_name1,count], outputs=[output1])
173
 
174
+ myface.queue(concurrency_count=400,status_update_rate=1)
175
+ myface.launch(inline=True,show_api=True)