ceyda commited on
Commit
19e4e13
1 Parent(s): 85a0494

add file uploader

Browse files

support providing image url or upload

Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -11,6 +11,7 @@ image_url = st.text_input(
11
  value="https://dl.fbaipublicfiles.com/dino/img.png",
12
  placeholder="https://your-favourite-image.png"
13
  )
 
14
 
15
  # Outputs
16
  st.title("Original Image from URL")
@@ -20,6 +21,10 @@ image, preprocessed_image = utils.load_image_from_url(
20
  image_url,
21
  model_type="dino"
22
  )
 
 
 
 
23
  st.image(image, caption="Original Image")
24
 
25
  # Load the DINO model
 
11
  value="https://dl.fbaipublicfiles.com/dino/img.png",
12
  placeholder="https://your-favourite-image.png"
13
  )
14
+ uploaded_files = st.file_uploader("or an image file", type =["jpg","jpeg"])
15
 
16
  # Outputs
17
  st.title("Original Image from URL")
 
21
  image_url,
22
  model_type="dino"
23
  )
24
+ if uploaded_file:
25
+ image = Image.open(im)
26
+ preprocessed_image = utils.preprocess_image(image, model_type)
27
+
28
  st.image(image, caption="Original Image")
29
 
30
  # Load the DINO model