Spaces:
Running
Running
import gradio as gr | |
import requests | |
import os | |
import gradio as gr | |
#from diffusers import StableDiffusionPipeline | |
#import torch | |
#model_id = "runwayml/stable-diffusion-v1-5" | |
#pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.get_default_dtype()) | |
#pipe = pipe.to("cpu") | |
name = "andite/anything-v4.0" | |
model = gr.Interface.load(f"models/{name}") | |
o = os.getenv("P") | |
h = "Q" | |
def ac(): | |
def im_fn(put): | |
if h == o: | |
return model([put, negative_prompt="blury"]) | |
elif h != o: | |
return(None) | |
''' | |
num_images_per_prompt=n_images, | |
num_inference_steps = int(steps), | |
guidance_scale = guidance, | |
width = width, | |
height = height, | |
generator = generator, | |
callback=pipe_callback) | |
''' | |
with gr.Blocks() as b: | |
put = gr.Textbox() | |
with gr.Row(): | |
out1 = gr.Image() | |
out2 = gr.Image() | |
with gr.Row(): | |
btn1 = gr.Button() | |
btn2 = gr.Button() | |
btn1.click(im_fn,put,out1) | |
btn2.click(im_pipe,put,out2) | |
b.queue(concurrency_count=100).launch() | |
ac() |