jableable commited on
Commit
0ad39d9
1 Parent(s): 4c0620a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -1,21 +1,16 @@
1
  import streamlit as st
2
  from datasets import load_dataset, Image
3
- from huggingface_hub import hf_hub_download
4
- pip install joblib
5
- import joblib
6
-
7
- REPO_ID = "jableable/road_project"
8
- FILENAME = "best_model.keras"
9
-
10
- model = joblib.load(
11
- hf_hub_download(repo_id=REPO_ID, filename=FILENAME)
12
- )
13
 
14
  x = st.slider('Select a value')
15
  st.write(x, 'squared is', x * x)
16
 
17
- loaded_model = keras.saving.load_model("best_model.keras")
18
 
 
 
 
 
19
 
20
 
21
  dataset = load_dataset("beans", split="train")
 
1
  import streamlit as st
2
  from datasets import load_dataset, Image
3
+ from huggingface_hub import from_pretrained_keras
 
 
 
 
 
 
 
 
 
4
 
5
  x = st.slider('Select a value')
6
  st.write(x, 'squared is', x * x)
7
 
8
+ #loaded_model = keras.saving.load_model("best_model.keras")
9
 
10
+ model = from_pretrained_keras("best_model.keras")
11
+ prediction = model.predict(image)
12
+ prediction = tf.squeeze(tf.round(prediction))
13
+ print(f'The image is a {classes[(np.argmax(prediction))]}!')
14
 
15
 
16
  dataset = load_dataset("beans", split="train")