yashpat85 commited on
Commit
a7de3a4
·
verified ·
1 Parent(s): 37307f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -5
app.py CHANGED
@@ -1,14 +1,26 @@
1
  import streamlit as st
2
  import pickle
3
  from Prediction import Prediction
4
- from transformers import TFAutoModel
5
-
6
 
7
 
8
  # resnet_model = pickle.load(open('models/ResNet01.pkl','rb'))
9
  # cnn_model = pickle.load(open('models/CNNModel2.pkl','rb'))
10
  # inc_model = pickle.load(open('models/Inception01.pkl','rb'))
11
- resnet_model = TFAutoModel.from_pretrained("yashpat85/ResNet01")
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
 
14
  def show_error_popup(message):
@@ -42,8 +54,8 @@ if uploaded_file is not None:
42
  p = pm.predict_image(cnn_model, image_data)
43
  elif option=="ResNet":
44
  p = pm.predict_image(resnet_model, image_data)
45
- elif option=="InceptionNet":
46
- p = pm.predict_image(inc_model, image_data)
47
  else:
48
  p = "Other Models are still under training due to overfitting"
49
 
 
1
  import streamlit as st
2
  import pickle
3
  from Prediction import Prediction
4
+ from huggingface_hub import hf_hub_download
 
5
 
6
 
7
  # resnet_model = pickle.load(open('models/ResNet01.pkl','rb'))
8
  # cnn_model = pickle.load(open('models/CNNModel2.pkl','rb'))
9
  # inc_model = pickle.load(open('models/Inception01.pkl','rb'))
10
+ # resnet_model = TFAutoModel.from_pretrained("yashpat85/ResNet01")
11
+
12
+ REPO_ID1 = "yashpat85/ResNet01"
13
+ MODEL_DIR1 = hf_hub_download(repo_id=REPO_ID1, filename="ResNet01.pkl", repo_type="model")
14
+
15
+ # REPO_ID2= "yashpat85/Inception01"
16
+ # MODEL_DIR2 = hf_hub_download(repo_id=REPO_ID2, filename="Inception01.pkl", repo_type="model")
17
+
18
+ REPO_ID3 = "yashpat85/CNNModel2"
19
+ MODEL_DIR3 = hf_hub_download(repo_id=REPO_ID3, filename="CNNModel2.pkl", repo_type="model")
20
+
21
+
22
+ resnet_model = pickle.load(open(MODEL_DIR1,'rb'))
23
+ cnn_model = pickle.load(open(MODEL_DIR3,'rb'))
24
 
25
 
26
  def show_error_popup(message):
 
54
  p = pm.predict_image(cnn_model, image_data)
55
  elif option=="ResNet":
56
  p = pm.predict_image(resnet_model, image_data)
57
+ # elif option=="InceptionNet":
58
+ # p = pm.predict_image(inc_model, image_data)
59
  else:
60
  p = "Other Models are still under training due to overfitting"
61