Spaces:
Runtime error
Runtime error
import cv2 | |
import numpy as np | |
import streamlit as st | |
from datasets import load_dataset | |
from PIL import Image | |
from matplotlib.pyplot import imshow | |
def load_dataset_from_Hugging_Face(): | |
reloaded_dataset_thermal = load_dataset("gokulraja17/rice-thermal-demo") | |
reloaded_dataset_rgb = load_dataset("gokulraja17/rice-rgb-demo2") | |
return reloaded_dataset_thermal,reloaded_dataset_rgb | |
dataset_thermal,dataset_rgb = load_dataset_from_Hugging_Face() | |
uploaded_file = st.file_uploader("Choose a image file", type=["jpg","png"]) | |
if uploaded_file is not None: | |
# Convert the file to an opencv image. | |
file_bytes = np.asarray(bytearray(uploaded_file.read()), dtype=np.uint8) | |
opencv_image = cv2.imdecode(file_bytes, 1) | |
# Now do something with the image! For example, let's display it: | |
st.image(opencv_image, channels="BGR") |