Spaces:
Runtime error
Runtime error
Raja
commited on
Commit
·
dffff3f
1
Parent(s):
df9ddb7
Trying dataset loading
Browse files- app.py +10 -1
- requirements.txt +4 -1
app.py
CHANGED
@@ -1,13 +1,22 @@
|
|
1 |
import cv2
|
2 |
import numpy as np
|
3 |
import streamlit as st
|
|
|
|
|
|
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
uploaded_file = st.file_uploader("Choose a image file", type=["jpg","png"])
|
6 |
|
7 |
if uploaded_file is not None:
|
8 |
# Convert the file to an opencv image.
|
9 |
file_bytes = np.asarray(bytearray(uploaded_file.read()), dtype=np.uint8)
|
10 |
opencv_image = cv2.imdecode(file_bytes, 1)
|
11 |
-
|
12 |
# Now do something with the image! For example, let's display it:
|
13 |
st.image(opencv_image, channels="BGR")
|
|
|
1 |
import cv2
|
2 |
import numpy as np
|
3 |
import streamlit as st
|
4 |
+
from datasets import load_dataset
|
5 |
+
from PIL import Image
|
6 |
+
from matplotlib.pyplot import imshow
|
7 |
|
8 |
+
def load_dataset_from_Hugging_Face():
|
9 |
+
reloaded_dataset_thermal = load_dataset("gokulraja17/rice-thermal-demo")
|
10 |
+
reloaded_dataset_rgb = load_dataset("gokulraja17/rice-rgb-demo2")
|
11 |
+
return reloaded_dataset_thermal,reloaded_dataset_rgb
|
12 |
+
|
13 |
+
dataset_thermal,dataset_rgb = load_dataset_from_Hugging_Face()
|
14 |
uploaded_file = st.file_uploader("Choose a image file", type=["jpg","png"])
|
15 |
|
16 |
if uploaded_file is not None:
|
17 |
# Convert the file to an opencv image.
|
18 |
file_bytes = np.asarray(bytearray(uploaded_file.read()), dtype=np.uint8)
|
19 |
opencv_image = cv2.imdecode(file_bytes, 1)
|
20 |
+
|
21 |
# Now do something with the image! For example, let's display it:
|
22 |
st.image(opencv_image, channels="BGR")
|
requirements.txt
CHANGED
@@ -1 +1,4 @@
|
|
1 |
-
opencv-python
|
|
|
|
|
|
|
|
1 |
+
opencv-python
|
2 |
+
transformers
|
3 |
+
datasets
|
4 |
+
matplotlib
|