Kaushik066 commited on
Commit
0b05083
·
verified ·
1 Parent(s): 81a4855

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -24,7 +24,7 @@ from torch.utils.data import Dataset, DataLoader
24
 
25
  # Other Generic Libraries
26
  import torch
27
- import PIL
28
  import os
29
  import streamlit as st
30
  import gc
@@ -135,7 +135,7 @@ class CreateDatasetProd():
135
  pixel_values = []
136
  for path in img_paths:
137
  # Read and process Images
138
- img = PIL.Image.open(path)
139
  img = self.transform_prod(img)
140
 
141
  # Scaling the video to ML model's desired format
@@ -174,9 +174,8 @@ prod_dl = DataLoader(prod_ds, batch_size=BATCH_SIZE)
174
  enable = st.checkbox("Enable camera")
175
  picture = st.camera_input("Take a picture", disabled=not enable)
176
  if picture is not None:
177
- img_bytes = picture.getvalue()
178
- img = PIL.Image.open(img_bytes)
179
- img.save(webcam_path, "JPEG")
180
  st.write('Image saved as:',webcam_path)
181
 
182
  # Create DataLoader for Webcam Image
 
24
 
25
  # Other Generic Libraries
26
  import torch
27
+ from PIL import Image
28
  import os
29
  import streamlit as st
30
  import gc
 
135
  pixel_values = []
136
  for path in img_paths:
137
  # Read and process Images
138
+ img = Image.open(path)
139
  img = self.transform_prod(img)
140
 
141
  # Scaling the video to ML model's desired format
 
174
  enable = st.checkbox("Enable camera")
175
  picture = st.camera_input("Take a picture", disabled=not enable)
176
  if picture is not None:
177
+ #img = Image.open(picture)
178
+ picture.save(webcam_path, "JPEG")
 
179
  st.write('Image saved as:',webcam_path)
180
 
181
  # Create DataLoader for Webcam Image