Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -61,32 +61,22 @@ models2=[
|
|
| 61 |
|
| 62 |
text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion_link",live=True, preprocess=True)
|
| 63 |
|
| 64 |
-
#proc1=gr.Interface.load(f"models/{model_1}",live=False,preprocess=True, postprocess=False)
|
| 65 |
-
#proc2=gr.Interface.load(f"models/{model_2}",live=False,preprocess=True, postprocess=False)
|
| 66 |
-
#proc3=gr.Interface.load(f"models/{model_3}",live=False,preprocess=True, postprocess=False)
|
| 67 |
-
#proc4=gr.Interface.load(f"models/{model_4}",live=False,preprocess=True, postprocess=False)
|
| 68 |
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
def emb():
|
| 72 |
with gr.Blocks(css="cake.css") as myface:
|
| 73 |
gr.HTML("""<head><meta http-equiv="refresh" content="180"></head>""")
|
| 74 |
|
| 75 |
-
|
| 76 |
-
output_list=[]
|
| 77 |
-
|
| 78 |
-
proc1=models2[model_choice]
|
| 79 |
-
output1=proc1(inputs)
|
| 80 |
-
|
| 81 |
-
output2=proc1(inputs)
|
| 82 |
-
output3=proc1(inputs)
|
| 83 |
-
output4=proc1(inputs)
|
| 84 |
-
output_list.append(output1)
|
| 85 |
-
output_list.append(output2)
|
| 86 |
-
output_list.append(output3)
|
| 87 |
-
output_list.append(output4)
|
| 88 |
-
|
| 89 |
-
return(output_list)
|
| 90 |
|
| 91 |
|
| 92 |
|
|
@@ -161,7 +151,7 @@ def emb():
|
|
| 161 |
input_text=gr.Textbox(label="Short Prompt")
|
| 162 |
prompt=gr.Textbox(label="Text to Image Prompt",visible=True)
|
| 163 |
model_name1 = gr.Dropdown(show_label=False, choices=[m for m in models], type="index", value=current_model, interactive=True)
|
| 164 |
-
|
| 165 |
with gr.Column():
|
| 166 |
see_prompts=gr.Button("Magic Prompt")
|
| 167 |
with gr.Row():
|
|
@@ -171,24 +161,15 @@ def emb():
|
|
| 171 |
with gr.Column(visible=True) as timo:
|
| 172 |
with gr.Row():
|
| 173 |
output1=gr.Gallery()
|
| 174 |
-
|
| 175 |
-
#output2=gr.Image(label=(f"{model_2}"),visible=True)
|
| 176 |
-
#output3=gr.Image(label=(f"{model_3}"),visible=True)
|
| 177 |
-
#output4=gr.Image(label=(f"{model_4}"),visible=True)
|
| 178 |
def get_prompts(prompt_text):
|
| 179 |
|
| 180 |
gen=text_gen(prompt_text)
|
| 181 |
return gen
|
| 182 |
|
| 183 |
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
#run3=run.click(send_it3, inputs=[prompt], outputs=[output3])
|
| 187 |
-
#run4=run.click(send_it4, inputs=[prompt], outputs=[output4])
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
#see_prompts.click(sesh_start,None,[start_box,end_box,tog_box])
|
| 191 |
-
prompt1=see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt],cancels=[run1])
|
| 192 |
myface.queue(concurrency_count=400,status_update_rate=1)
|
| 193 |
myface.launch(inline=True,show_api=False)
|
| 194 |
if __name__ == "__main__":
|
|
|
|
| 61 |
|
| 62 |
text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion_link",live=True, preprocess=True)
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
+
def send_it1(inputs,model_choice, count = 1):
|
| 67 |
+
t=0
|
| 68 |
+
output_list=[]
|
| 69 |
+
while t<int(count):
|
| 70 |
+
proc1=models2[model_choice]
|
| 71 |
+
output1=proc1(inputs)
|
| 72 |
+
output_list.append(output1)
|
| 73 |
+
return(output_list)
|
| 74 |
|
| 75 |
def emb():
|
| 76 |
with gr.Blocks(css="cake.css") as myface:
|
| 77 |
gr.HTML("""<head><meta http-equiv="refresh" content="180"></head>""")
|
| 78 |
|
| 79 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
|
| 82 |
|
|
|
|
| 151 |
input_text=gr.Textbox(label="Short Prompt")
|
| 152 |
prompt=gr.Textbox(label="Text to Image Prompt",visible=True)
|
| 153 |
model_name1 = gr.Dropdown(show_label=False, choices=[m for m in models], type="index", value=current_model, interactive=True)
|
| 154 |
+
count = gr.Number(value=1)
|
| 155 |
with gr.Column():
|
| 156 |
see_prompts=gr.Button("Magic Prompt")
|
| 157 |
with gr.Row():
|
|
|
|
| 161 |
with gr.Column(visible=True) as timo:
|
| 162 |
with gr.Row():
|
| 163 |
output1=gr.Gallery()
|
| 164 |
+
|
|
|
|
|
|
|
|
|
|
| 165 |
def get_prompts(prompt_text):
|
| 166 |
|
| 167 |
gen=text_gen(prompt_text)
|
| 168 |
return gen
|
| 169 |
|
| 170 |
|
| 171 |
+
run1=run.click(send_it1, inputs=[prompt, model_name1,count], outputs=[output1])
|
| 172 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
myface.queue(concurrency_count=400,status_update_rate=1)
|
| 174 |
myface.launch(inline=True,show_api=False)
|
| 175 |
if __name__ == "__main__":
|