File size: 1,162 Bytes
9434e34
b2d28b6
a231759
0ad39d9
c1963d4
5d5a58a
f2669ad
9434e34
c1963d4
b2d28b6
a3b1bd8
 
c2ef5b3
b054c62
4d9efce
2fcfc85
4cb3cd0
0993ad1
a3b1bd8
 
c1963d4
0eb8c57
 
 
 
 
 
 
7f8233b
d461fd5
7f8233b
b2d28b6
 
dbdd9ed
 
 
7f8233b
 
dbdd9ed
7f8233b
dbdd9ed
 
7f8233b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import streamlit as st
from transformers import pipeline
#from datasets import load_dataset, Image
from huggingface_hub import from_pretrained_keras
import keras
import numpy as np
from PIL import Image

loaded_model = keras.saving.load_model("best_model.keras")

uploaded_img = st.file_uploader("Upload your file here...",type=['png', 'jpeg', 'jpg'])

if uploaded_img is not None:
    st.image(uploaded_img)
    img = Image.open(uploaded_img).resize((160, 160))
    img = np.array(img)
    result = loaded_model.predict(img[None,:,:])
    st.write(f"Your prediction is: {result}")


#model = from_pretrained_keras("jableable/road_model")

#pipe = pipeline('sentiment-analysis')
#text = st.text_area('enter some text!')

#if text:
    #out = pipe(text)
    #st.json(out)

#loaded_model = keras.saving.load_model("jableable/road_model")

#model = from_pretrained_keras("keras-io/ocr-for-captcha")
#model.summary()
#prediction = model.predict(image)
#prediction = tf.squeeze(tf.round(prediction))
#print(f'The image is a {classes[(np.argmax(prediction))]}!')


#dataset = load_dataset("beans", split="train")

#loaded_img = dataset[0]["image"]
#print(loaded_img)