Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -84,7 +84,7 @@ def evf_sam_mask(image, prompt):
|
|
84 |
|
85 |
@spaces.GPU(duration=150)
|
86 |
def process(
|
87 |
-
|
88 |
input_text: str,
|
89 |
inpaint_text: str,
|
90 |
seed_slicer: int,
|
@@ -97,15 +97,15 @@ def process(
|
|
97 |
gr.Info("Please enter a text prompt.")
|
98 |
return None
|
99 |
|
100 |
-
image = input_image_editor['background']
|
101 |
#mask = input_image_editor['layers'][0]
|
102 |
-
print(f"type of image: {type(
|
103 |
-
mask = evf_sam_mask(
|
104 |
print(f"type of mask: {type(mask)}")
|
105 |
print(f"inpaint_text: {inpaint_text}")
|
106 |
print(f"input_text: {input_text}")
|
107 |
|
108 |
-
if not
|
109 |
gr.Info("Please upload an image.")
|
110 |
return None
|
111 |
|
@@ -113,8 +113,8 @@ def process(
|
|
113 |
gr.Info("Please draw a mask on the image.")
|
114 |
return None
|
115 |
|
116 |
-
width, height = resize_image_dimensions(original_resolution_wh=
|
117 |
-
resized_image =
|
118 |
resized_mask = mask.resize((width, height), Image.NEAREST)
|
119 |
|
120 |
if randomize_seed_checkbox:
|
@@ -138,7 +138,7 @@ with gr.Blocks() as demo:
|
|
138 |
gr.Markdown(MARKDOWN)
|
139 |
with gr.Row():
|
140 |
with gr.Column():
|
141 |
-
|
142 |
label='Image',
|
143 |
type='pil',
|
144 |
sources=["upload", "webcam"],
|
@@ -202,7 +202,7 @@ with gr.Blocks() as demo:
|
|
202 |
submit_button_component.click(
|
203 |
fn=process,
|
204 |
inputs=[
|
205 |
-
input_image_editor_component,
|
206 |
input_text_component,
|
207 |
inpaint_text_component,
|
208 |
seed_slicer_component,
|
|
|
84 |
|
85 |
@spaces.GPU(duration=150)
|
86 |
def process(
|
87 |
+
input_image: dict,
|
88 |
input_text: str,
|
89 |
inpaint_text: str,
|
90 |
seed_slicer: int,
|
|
|
97 |
gr.Info("Please enter a text prompt.")
|
98 |
return None
|
99 |
|
100 |
+
#image = input_image_editor['background']
|
101 |
#mask = input_image_editor['layers'][0]
|
102 |
+
print(f"type of image: {type(input_image)}")
|
103 |
+
mask = evf_sam_mask(input_image, input_text)
|
104 |
print(f"type of mask: {type(mask)}")
|
105 |
print(f"inpaint_text: {inpaint_text}")
|
106 |
print(f"input_text: {input_text}")
|
107 |
|
108 |
+
if not input_image:
|
109 |
gr.Info("Please upload an image.")
|
110 |
return None
|
111 |
|
|
|
113 |
gr.Info("Please draw a mask on the image.")
|
114 |
return None
|
115 |
|
116 |
+
width, height = resize_image_dimensions(original_resolution_wh=input_image.size)
|
117 |
+
resized_image = input_image.resize((width, height), Image.LANCZOS)
|
118 |
resized_mask = mask.resize((width, height), Image.NEAREST)
|
119 |
|
120 |
if randomize_seed_checkbox:
|
|
|
138 |
gr.Markdown(MARKDOWN)
|
139 |
with gr.Row():
|
140 |
with gr.Column():
|
141 |
+
input_image = gr.ImageEditor( #input_image_editor_component
|
142 |
label='Image',
|
143 |
type='pil',
|
144 |
sources=["upload", "webcam"],
|
|
|
202 |
submit_button_component.click(
|
203 |
fn=process,
|
204 |
inputs=[
|
205 |
+
input_image, #input_image_editor_component,
|
206 |
input_text_component,
|
207 |
inpaint_text_component,
|
208 |
seed_slicer_component,
|