text-to-image / app.py
xp3857's picture
Update app.py
b6eb1a4
raw
history blame
1.11 kB
import gradio as gr
import requests
import os
import gradio as gr
from transformers import pipeline
name = "andite/anything-v4.0"
model = gr.Interface.load(f"models/{name}")
pipe = pipeline(model=f"models/{name}")
pi = gr.Interface.from_pipeline(pipe)
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 pi(put,negative_prompt = 'blury')
'''
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()