juaben commited on
Commit
a76fdf3
·
verified ·
1 Parent(s): 18ff062

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -2
app.py CHANGED
@@ -98,8 +98,22 @@ def update_filename(image):
98
  return filename
99
  return ""
100
 
101
- # Define the update logic for filename
102
- demo.input_components[0].change(update_filename, inputs=demo.input_components[0], outputs=demo.input_components[1])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
 
104
  if __name__ == '__main__':
105
  demo.launch()
 
98
  return filename
99
  return ""
100
 
101
+ with gr.Blocks() as demo:
102
+ with gr.Row():
103
+ input_image = gr.Image(type='pil', label='input')
104
+ filename_output = gr.Textbox(label="Image Filename", interactive=False)
105
+
106
+ # Define the output
107
+ output_image = gr.Image(type='pil', label='output')
108
+
109
+ # Define the interaction flow: when the image is uploaded, update the filename
110
+ input_image.change(update_filename, inputs=input_image, outputs=filename_output)
111
+
112
+ # Set the function to process the image with the filename
113
+ input_image.submit(process_img, inputs=[input_image, filename_output], outputs=output_image)
114
+
115
+ # Provide examples
116
+ demo.examples = examples
117
 
118
  if __name__ == '__main__':
119
  demo.launch()