Spaces:
Running
on
Zero
Running
on
Zero
Commit
•
75513f7
1
Parent(s):
99030f7
Update app.py
Browse files
app.py
CHANGED
@@ -126,6 +126,7 @@ def generate(image, prompt_user, progress=gr.Progress(track_tqdm=True)):
|
|
126 |
print(error_message) # For logging
|
127 |
raise gr.Error(error_message)
|
128 |
|
|
|
129 |
print("Size after cropping", cropped_image.size)
|
130 |
|
131 |
try:
|
@@ -134,7 +135,7 @@ def generate(image, prompt_user, progress=gr.Progress(track_tqdm=True)):
|
|
134 |
error_message = f"Error during duplication: {str(e)}"
|
135 |
print(error_message) # For logging
|
136 |
raise gr.Error(error_message)
|
137 |
-
|
138 |
print("just before getting into pipe")
|
139 |
# Generate output
|
140 |
out = pipe(
|
@@ -150,11 +151,11 @@ def generate(image, prompt_user, progress=gr.Progress(track_tqdm=True)):
|
|
150 |
).images[0]
|
151 |
|
152 |
# First yield for progress
|
153 |
-
yield
|
154 |
|
155 |
# Process and return final output
|
156 |
image_2 = safe_crop_output(out)
|
157 |
-
yield
|
158 |
|
159 |
except Exception as e:
|
160 |
error_message = f"Error during generation: {str(e)}"
|
@@ -189,6 +190,8 @@ with gr.Blocks() as demo:
|
|
189 |
label="Side by side",
|
190 |
type="pil"
|
191 |
)
|
|
|
|
|
192 |
|
193 |
with gr.Row():
|
194 |
gr.Markdown("""
|
@@ -204,7 +207,7 @@ with gr.Blocks() as demo:
|
|
204 |
generate_btn.click(
|
205 |
fn=generate,
|
206 |
inputs=[input_image, prompt_input],
|
207 |
-
outputs=[
|
208 |
api_name="generate"
|
209 |
)
|
210 |
|
|
|
126 |
print(error_message) # For logging
|
127 |
raise gr.Error(error_message)
|
128 |
|
129 |
+
yield debug_resize, None, None, None
|
130 |
print("Size after cropping", cropped_image.size)
|
131 |
|
132 |
try:
|
|
|
135 |
error_message = f"Error during duplication: {str(e)}"
|
136 |
print(error_message) # For logging
|
137 |
raise gr.Error(error_message)
|
138 |
+
yield debug_resize, debug_duplicate, None, None
|
139 |
print("just before getting into pipe")
|
140 |
# Generate output
|
141 |
out = pipe(
|
|
|
151 |
).images[0]
|
152 |
|
153 |
# First yield for progress
|
154 |
+
yield debug_resize, debug_duplicate, out, None
|
155 |
|
156 |
# Process and return final output
|
157 |
image_2 = safe_crop_output(out)
|
158 |
+
yield debug_resize, debug_duplicate, out, image_2
|
159 |
|
160 |
except Exception as e:
|
161 |
error_message = f"Error during generation: {str(e)}"
|
|
|
190 |
label="Side by side",
|
191 |
type="pil"
|
192 |
)
|
193 |
+
debug_resize = gr.Image()
|
194 |
+
debug_duplicate = gr.Image()
|
195 |
|
196 |
with gr.Row():
|
197 |
gr.Markdown("""
|
|
|
207 |
generate_btn.click(
|
208 |
fn=generate,
|
209 |
inputs=[input_image, prompt_input],
|
210 |
+
outputs=[debug_resize, debug_duplicate, output_side, output_image],
|
211 |
api_name="generate"
|
212 |
)
|
213 |
|