Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -3,27 +3,38 @@ import requests
|
|
3 |
import os
|
4 |
|
5 |
name2 = "runwayml/stable-diffusion-v1-5"
|
6 |
-
name1 = "andite/anything-v4.0"
|
7 |
model = gr.Interface.load(f"models/{name2}")
|
8 |
|
9 |
|
10 |
o = os.getenv("P")
|
11 |
h = "Q"
|
12 |
def ac():
|
13 |
-
def im_fn(put):
|
14 |
if h == o:
|
15 |
-
|
16 |
-
|
|
|
17 |
elif h != o:
|
18 |
-
return(None)
|
19 |
-
|
|
|
20 |
with gr.Blocks() as b:
|
21 |
-
|
|
|
|
|
22 |
with gr.Row():
|
23 |
out1 = gr.Image()
|
|
|
24 |
with gr.Row():
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
|
|
28 |
b.queue(concurrency_count=100).launch()
|
29 |
ac()
|
|
|
3 |
import os
|
4 |
|
5 |
name2 = "runwayml/stable-diffusion-v1-5"
|
|
|
6 |
model = gr.Interface.load(f"models/{name2}")
|
7 |
|
8 |
|
9 |
o = os.getenv("P")
|
10 |
h = "Q"
|
11 |
def ac():
|
12 |
+
def im_fn(put,fac=""):
|
13 |
if h == o:
|
14 |
+
put = f"{put}{fac}"
|
15 |
+
fac = f"{fac} "
|
16 |
+
return model(put),fac
|
17 |
elif h != o:
|
18 |
+
return(None,None)
|
19 |
+
def cl_fac():
|
20 |
+
return ""
|
21 |
with gr.Blocks() as b:
|
22 |
+
with gr.Row():
|
23 |
+
put = gr.Textbox()
|
24 |
+
btn1 = gr.Button()
|
25 |
with gr.Row():
|
26 |
out1 = gr.Image()
|
27 |
+
out2 = gr.Image()
|
28 |
with gr.Row():
|
29 |
+
out3 = gr.Image()
|
30 |
+
out4 = gr.Image()
|
31 |
+
fac_b = gr.Textbox(value="",visible=False)
|
32 |
+
btn1.click(cl_fac,None,fac_b)
|
33 |
+
btn1.click(im_fn,[put,fac],[out1,fac_b])
|
34 |
+
out1.change(im_fn,[put,fac],[out2,fac_b])
|
35 |
+
out2.change(im_fn,[put,fac],[out3,fac_b])
|
36 |
+
out3.change(im_fn,[put,fac],[out4,fac_b])
|
37 |
|
38 |
+
|
39 |
b.queue(concurrency_count=100).launch()
|
40 |
ac()
|