File size: 2,070 Bytes
b6b08f6
3353a40
af2f25b
477a5c9
 
 
 
3353a40
f9a8fb9
477a5c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
af2f25b
8646ee7
a2ffcba
a8fdbd7
a2ffcba
477a5c9
 
184a373
 
477a5c9
184a373
a2ffcba
184a373
 
 
843d81d
184a373
 
 
b6eb1a4
 
184a373
b6eb1a4
184a373
 
cead56a
e540908
184a373
 
ed523c3
35cd00c
 
 
8646ee7
af2f25b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import gradio as gr
import requests
import os
import random




name2 = "runwayml/stable-diffusion-v1-5"
models=[
    gr.Interface.load(f"models/{name2}"),
    gr.Interface.load(f"models/{name2}"),
    gr.Interface.load(f"models/{name2}"),
    gr.Interface.load(f"models/{name2}"),
    gr.Interface.load(f"models/{name2}"),
    gr.Interface.load(f"models/{name2}"),
    gr.Interface.load(f"models/{name2}"),
    gr.Interface.load(f"models/{name2}"),
    gr.Interface.load(f"models/{name2}"),
    gr.Interface.load(f"models/{name2}"),
    gr.Interface.load(f"models/{name2}"),
    gr.Interface.load(f"models/{name2}"),
    gr.Interface.load(f"models/{name2}"),
    gr.Interface.load(f"models/{name2}"),
    gr.Interface.load(f"models/{name2}"),
    gr.Interface.load(f"models/{name2}"),
    gr.Interface.load(f"models/{name2}"),
    gr.Interface.load(f"models/{name2}"),
    gr.Interface.load(f"models/{name2}"),
    gr.Interface.load(f"models/{name2}"),
]
o = os.getenv("P")

def ac():
    def im_fn(put,fac="",h=None):
        if h == o:
            rn = random.randint(0, 19)
            model=models[rn]
            put = f"{put}{fac}"
            fac = f"{fac} "
            print (rn)
            return model(put),fac
        elif h != o:
            return(None,None)
    def cl_fac():
        return ""
    with gr.Blocks(css='css.css') as b:
        with gr.Row():
            put = gr.Textbox()            
            btn1 = gr.Button()
        with gr.Row():
            out1 = gr.Image()
            out2 = gr.Image()
        with gr.Row():
            out3 = gr.Image()
            out4 = gr.Image()
        with gr.Row(visible=False):
            h=gr.Textbox("Q")
        fac_b = gr.Textbox(value="",visible=False)
        btn1.click(cl_fac,None,fac_b)
        btn1.click(im_fn,[put,fac_b,h],[out1,fac_b])
        out1.change(im_fn,[put,fac_b,h],[out2,fac_b])        
        out2.change(im_fn,[put,fac_b,h],[out3,fac_b])        
        out3.change(im_fn,[put,fac_b,h],[out4,fac_b])        
    b.queue(concurrency_count=100).launch(show_api=False)
ac()