Spaces:
Runtime error
Runtime error
create
Browse files
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import requests
|
3 |
+
|
4 |
+
|
5 |
+
def get_sd(translated_txt):
|
6 |
+
print("******** Inside get_SD ********")
|
7 |
+
print(f"translated_txt is : {translated_txt}")
|
8 |
+
sd_inf = gr.Blocks.load(name="spaces/stabilityai/stable-diffusion")
|
9 |
+
print(f"stable Diff inf is : {sd_inf}")
|
10 |
+
tbox, sd_img_gallery = gr.Blocks.load(name="spaces/stabilityai/stable-diffusion")(translated_txt, 4, 45, 7.5, 1024, fn_index=2) #(prompt, samples, steps, scale, seed)
|
11 |
+
|
12 |
+
return sd_img_gallery[0]
|
13 |
+
|
14 |
+
demo = gr.Blocks()
|
15 |
+
|
16 |
+
with demo:
|
17 |
+
gr.Markdown("Testing Diffusion models. STILL VERY MUCH WORK IN PROGRESS !!!!!!!!")
|
18 |
+
|
19 |
+
with gr.Row():
|
20 |
+
in_text_prompt = gr.Textbox(label="Enter English text here")
|
21 |
+
#out_text_chinese = gr.Textbox(label="Your Chinese language output")
|
22 |
+
b1 = gr.Button("Generate SD")
|
23 |
+
|
24 |
+
out_sd = gr.Image(type="pil", label="SD output for the given prompt")
|
25 |
+
|
26 |
+
b1.click(get_sd, in_text_prompt, out_sd) #out_gallery )
|
27 |
+
|
28 |
+
demo.launch(enable_queue=True, debug=True)
|