kusumakar commited on
Commit
9247ad2
·
1 Parent(s): c598532

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  from PIL import Image
2
  import streamlit as st
3
  from transformers import GPT2Tokenizer, GPT2LMHeadModel
@@ -44,10 +45,10 @@ def main():
44
  # check if file has been uploaded
45
  if uploaded_file is not None:
46
  # load the image
47
- image = Image.open(uploaded_file).convert("RGB")
48
-
49
  # context as prompt
50
- prompt = generate_captions(uploaded_file)
51
  st.write("The Context is:", prompt)
52
 
53
  # display the image
 
1
+ import numpy as np
2
  from PIL import Image
3
  import streamlit as st
4
  from transformers import GPT2Tokenizer, GPT2LMHeadModel
 
45
  # check if file has been uploaded
46
  if uploaded_file is not None:
47
  # load the image
48
+ image = np.array(Image.open(uploaded_file).resize((224, 224)))
49
+
50
  # context as prompt
51
+ prompt = generate_captions(image)
52
  st.write("The Context is:", prompt)
53
 
54
  # display the image