ysharma's picture
ysharma HF staff
create
02a85c7
import gradio as gr
import requests
def get_sd(translated_txt):
print("******** Inside get_SD ********")
print(f"translated_txt is : {translated_txt}")
sd_inf = gr.Blocks.load(name="spaces/stabilityai/stable-diffusion")
print(f"stable Diff inf is : {sd_inf}")
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)
return sd_img_gallery[0]
demo = gr.Blocks()
with demo:
gr.Markdown("Testing Diffusion models. STILL VERY MUCH WORK IN PROGRESS !!!!!!!!")
with gr.Row():
in_text_prompt = gr.Textbox(label="Enter English text here")
#out_text_chinese = gr.Textbox(label="Your Chinese language output")
b1 = gr.Button("Generate SD")
out_sd = gr.Image(type="pil", label="SD output for the given prompt")
b1.click(get_sd, in_text_prompt, out_sd) #out_gallery )
demo.launch(enable_queue=True, debug=True)