Pix2Pix-Video / app.py
fffiloni's picture
Update app.py
e6d116a
raw
history blame
947 Bytes
import gradio as gr
import os
token = os.environ.get('HF_TOKEN')
pix2pix = gr.Blocks.load(name="spaces/fffiloni/instruct-pix2pix-clone", api_key=token)
def infer(prompt,image):
result = pix2pix(prompt,
5.5,
1.5,
image,
15,
"",
512,
512,
0,
fn_index=0)
print(result)
print(result[0])
print(result[0][0])
# return "done"
images = [os.path.join(result[0], img) for img in os.listdir(result[0])]
return images[0]
with gr.Blocks() as demo:
with gr.Column():
prompt = gr.Textbox(placeholder="enter prompt")
image = gr.Image(source="upload", type="filepath")
image_out = gr.Image()
#text_out = gr.Textbox()
submit_btn = gr.Button("go")
inputs = [
prompt,
image
]
outputs = [image_out]
#outputs = [text_out]
submit_btn.click(infer, inputs, outputs)
demo.launch().queue()