princeml commited on
Commit
c0dea5a
1 Parent(s): 4d2d10a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -7,6 +7,7 @@
7
  # from streamlit_webrtc import webrtc_streamer, VideoTransformerBase, RTCConfiguration, VideoProcessorBase, WebRtcMode
8
  import numpy as np
9
  import tensorflow
 
10
  import cv2
11
  import streamlit as st
12
  from tensorflow import keras
@@ -117,10 +118,8 @@ def main():
117
  st.header("Image Prediction App")
118
  uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
119
  if uploaded_file is not None:
120
- with st.proto.TempFile(suffix=".jpg") as temp:
121
- temp.write(uploaded_file.getvalue())
122
- temp.seek(0)
123
- image = cv2.imread(temp.name)
124
  prediction = generate_prediction(image)
125
  st.image(prediction, use_column_width=True)
126
  # elif choice == "By Images":
 
7
  # from streamlit_webrtc import webrtc_streamer, VideoTransformerBase, RTCConfiguration, VideoProcessorBase, WebRtcMode
8
  import numpy as np
9
  import tensorflow
10
+ from PIL import Image
11
  import cv2
12
  import streamlit as st
13
  from tensorflow import keras
 
118
  st.header("Image Prediction App")
119
  uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
120
  if uploaded_file is not None:
121
+ image = np.array(Image.open(uploaded_file))
122
+
 
 
123
  prediction = generate_prediction(image)
124
  st.image(prediction, use_column_width=True)
125
  # elif choice == "By Images":