Andrei Zhytkevich commited on
Commit
aa5ae13
1 Parent(s): 7b9aa96

fix error when parameters do not exist

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +5 -1
README.md CHANGED
@@ -15,7 +15,7 @@ license: wtfpl
15
  This is Gradio project for reading and displaying an image and its metadata from url.
16
 
17
  ## Usage
18
- - Copy image link;
19
  - Paste it into the **url** field
20
  - Submit
21
 
 
15
  This is Gradio project for reading and displaying an image and its metadata from url.
16
 
17
  ## Usage
18
+ - Copy image address;
19
  - Paste it into the **url** field
20
  - Submit
21
 
app.py CHANGED
@@ -14,7 +14,11 @@ def display_image_from_url(url):
14
  image = Image.open(res)
15
  image.load()
16
 
17
- return image, image.info['parameters'], image.info
 
 
 
 
18
 
19
  server = gr.Interface(display_image_from_url, "text", ["image", gr.Textbox(label="Generation Parameters"), gr.Textbox(label="Metadata")])
20
  server.launch()
 
14
  image = Image.open(res)
15
  image.load()
16
 
17
+ parameters = "Parameters have been erased from this image"
18
+ if 'parameters' in image.info:
19
+ parameters = image.info['parameters']
20
+
21
+ return image, parameters, image.info
22
 
23
  server = gr.Interface(display_image_from_url, "text", ["image", gr.Textbox(label="Generation Parameters"), gr.Textbox(label="Metadata")])
24
  server.launch()