saq1b commited on
Commit
8ad46a2
·
verified ·
1 Parent(s): db0a52c

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py CHANGED
@@ -127,6 +127,13 @@ def undo_edit(image_history):
127
  else:
128
  return None, [], "No previous version available"
129
 
 
 
 
 
 
 
 
130
  # Create Gradio UI
131
  def create_ui():
132
  with gr.Blocks(title="Gemini Image Editor") as app:
@@ -156,6 +163,7 @@ def create_ui():
156
  with gr.Row():
157
  edit_btn = gr.Button("Edit Image")
158
  undo_btn = gr.Button("Undo Last Edit")
 
159
 
160
  with gr.Column():
161
  output_image = gr.Image(type="pil", label="Edited Image")
@@ -173,6 +181,13 @@ def create_ui():
173
  inputs=[image_history],
174
  outputs=[output_image, image_history, status]
175
  )
 
 
 
 
 
 
 
176
 
177
  return app
178
 
 
127
  else:
128
  return None, [], "No previous version available"
129
 
130
+ # Function to set output image as input for continuous editing
131
+ def continue_editing(output_image):
132
+ if output_image is not None:
133
+ return output_image, "Ready to continue editing the current image"
134
+ else:
135
+ return None, "No edited image available to continue editing"
136
+
137
  # Create Gradio UI
138
  def create_ui():
139
  with gr.Blocks(title="Gemini Image Editor") as app:
 
163
  with gr.Row():
164
  edit_btn = gr.Button("Edit Image")
165
  undo_btn = gr.Button("Undo Last Edit")
166
+ continue_btn = gr.Button("Continue Editing")
167
 
168
  with gr.Column():
169
  output_image = gr.Image(type="pil", label="Edited Image")
 
181
  inputs=[image_history],
182
  outputs=[output_image, image_history, status]
183
  )
184
+
185
+ # Add handler for continue editing button
186
+ continue_btn.click(
187
+ fn=continue_editing,
188
+ inputs=[output_image],
189
+ outputs=[input_image, status]
190
+ )
191
 
192
  return app
193