Spaces:
Runtime error
Runtime error
import gradio as gr | |
import numpy as np | |
from edict_functions import EDICT_editing | |
from PIL import Image | |
def greet(name): | |
return "Hello " + name + "!!" | |
def edict(x, source_text, edit_text, | |
edit_strength, guidance_scale, | |
steps=50, mix_weight=0.93, ): | |
x = Image.fromarray(x) | |
return_im = EDICT_editing(x, | |
source_text, | |
edit_text, | |
steps=steps, | |
mix_weight=mix_weight, | |
init_image_strength=edit_strength, | |
guidance_scale=guidance_scale | |
)[0] | |
return np.array(return_im) | |
iface = gr.Interface(fn=edict, inputs=["image", | |
gr.Textbox(label="Original Description"), | |
gr.Textbox(label="Edit Description"), | |
# 50, # gr.Slider(5, 50, value=20, step=1), | |
# 0.93, # gr.Slider(0.5, 1, value=0.7, step=0.05), | |
gr.Slider(0.0, 1, value=0.8, step=0.05), | |
gr.Slider(0, 10, value=3, step=0.5), | |
], | |
outputs="image") | |
iface.launch() | |