xp3857 commited on
Commit
e4390cd
·
1 Parent(s): 3cca507

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +40 -0
app.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
3
+ import requests
4
+ r = requests.get(f'https://huggingface.co/spaces/xp3857/text-to-image/raw/main/css.css')
5
+ css = r.text
6
+
7
+
8
+ model = gr.Interface.load(f"models/darkstorm2150/Protogen_x5.8_Official_Release")
9
+ #o = os.getenv("P")
10
+ o = "V"
11
+ def ac():
12
+ def im_fn(put,fac="",h=None):
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(css=css) 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
+ with gr.Row(visible=False):
32
+ h=gr.Textbox(value="V")
33
+ fac_b = gr.Textbox(value="",visible=False)
34
+ btn1.click(cl_fac,None,fac_b)
35
+ btn1.click(im_fn,[put,fac_b,h],[out1,fac_b])
36
+ out1.change(im_fn,[put,fac_b,h],[out2,fac_b])
37
+ out2.change(im_fn,[put,fac_b,h],[out3,fac_b])
38
+ out3.change(im_fn,[put,fac_b,h],[out4,fac_b])
39
+ b.queue(concurrency_count=100).launch(show_api=False)
40
+ ac()