Jugg-XL / app.py
xp3857's picture
Update app.py
f47bb49
raw
history blame
1.23 kB
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.float16)
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)
def im_pipe(put):
return pipe(put, negative_prompt="blury").images[0]
'''
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()