montyanderson commited on
Commit
d245bfd
1 Parent(s): d49e1e5

`app.py`: get exif data on upload

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -100,12 +100,6 @@ def flip_text(prompt, negative_prompt, model, steps, sampler, cfg_scale, width,
100
 
101
  return job["imageUrl"]
102
 
103
- def get_exif_data(image):
104
- print(image)
105
- exif = image.getexif()
106
- print(exif)
107
-
108
- return image.info
109
 
110
  css = """
111
  #generate {
@@ -180,14 +174,17 @@ with gr.Blocks(css=css) as demo:
180
  text_button.click(flip_text, inputs=[prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed], outputs=image_output)
181
 
182
  with gr.Tab("PNG Info"):
 
 
 
183
  with gr.Row():
184
  with gr.Column():
185
  image_input = gr.Image(type="pil")
 
186
  with gr.Column():
187
- exif_button = gr.Button("Get input data")
188
  exif_output = gr.Textbox(label="EXIF Data")
189
 
190
- exif_button.click(get_exif_data, inputs=[image_input], outputs=exif_output)
191
 
192
 
193
  demo.queue(concurrency_count=24)
 
100
 
101
  return job["imageUrl"]
102
 
 
 
 
 
 
 
103
 
104
  css = """
105
  #generate {
 
174
  text_button.click(flip_text, inputs=[prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height, seed], outputs=image_output)
175
 
176
  with gr.Tab("PNG Info"):
177
+ def get_exif_data(image):
178
+ return image.info
179
+
180
  with gr.Row():
181
  with gr.Column():
182
  image_input = gr.Image(type="pil")
183
+
184
  with gr.Column():
 
185
  exif_output = gr.Textbox(label="EXIF Data")
186
 
187
+ image_input.upload(get_exif_data, inputs=[image_input], outputs=exif_output)
188
 
189
 
190
  demo.queue(concurrency_count=24)