Nuno-Tome commited on
Commit
596475f
1 Parent(s): 9d1b6ab
Files changed (1) hide show
  1. app.py +36 -32
app.py CHANGED
@@ -49,11 +49,12 @@ def classify_full_dataset(shosen_dataset_name, chosen_model_name):
49
 
50
  #dataset
51
  dataset = load_dataset(shosen_dataset_name,"testedata_readme")
52
- #Image teste load
53
- image_object = dataset['pasta'][0]["image"]
54
- st.image(image_object, caption="Uploaded Image", width=300)
55
- st.write("### FLAG 3")
56
-
 
57
  #modle instance
58
  classifier_pipeline = pipeline('image-classification', model=chosen_model_name)
59
  st.write("### FLAG 4")
@@ -72,35 +73,38 @@ def classify_full_dataset(shosen_dataset_name, chosen_model_name):
72
 
73
  def main():
74
  st.title("Bulk Image Classification DEMO")
75
- st.markdown("This app uses several 🤗 models to classify images stored in 🤗 datasets.")
76
- st.write("Soon we will have a dataset template")
77
 
78
- ## Restart or reset your app
79
- #if st.button("Restart"):
80
- ## Code to restart or reset your app goes here
81
- # st.experimental_rerun()
82
-
83
- #Model
84
- chosen_model_name = st.selectbox("Select the model to use", MODELS, index=0)
85
- if chosen_model_name is not None:
86
- st.write("You selected", chosen_model_name)
87
-
88
- #Dataset
89
- shosen_dataset_name = st.selectbox("Select the dataset to use", DATASETS, index=0)
90
- if shosen_dataset_name is not None:
91
- st.write("You selected", shosen_dataset_name)
92
 
93
- #click to classify
94
- #image_object = dataset['pasta'][0]
95
- if chosen_model_name is not None and shosen_dataset_name is not None:
96
- if st.button("Classify images"):
97
-
98
- #classification_array =[]
99
- classification_result = classify_full_dataset(shosen_dataset_name, chosen_model_name)
100
- st.write(f"Classification result: {classification_result}")
101
- #classification_array.append(classification_result)
102
- #st.write("# FLAG 6")
103
- #st.write(classification_array)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
  if __name__ == "__main__":
106
  main()
 
49
 
50
  #dataset
51
  dataset = load_dataset(shosen_dataset_name,"testedata_readme")
52
+ with col2:
53
+ #Image teste load
54
+ image_object = dataset['pasta'][0]["image"]
55
+ st.image(image_object, caption="Uploaded Image", width=300)
56
+ st.write("### FLAG 3")
57
+
58
  #modle instance
59
  classifier_pipeline = pipeline('image-classification', model=chosen_model_name)
60
  st.write("### FLAG 4")
 
73
 
74
  def main():
75
  st.title("Bulk Image Classification DEMO")
76
+ col1, col2 = st.columns([3, 1])
 
77
 
78
+ with col1:
79
+ st.markdown("This app uses several 🤗 models to classify images stored in 🤗 datasets.")
80
+ st.write("Soon we will have a dataset template")
 
 
 
 
 
 
 
 
 
 
 
81
 
82
+ ## Restart or reset your app
83
+ #if st.button("Restart"):
84
+ ## Code to restart or reset your app goes here
85
+ # st.experimental_rerun()
86
+
87
+ #Model
88
+ chosen_model_name = st.selectbox("Select the model to use", MODELS, index=0)
89
+ if chosen_model_name is not None:
90
+ st.write("You selected", chosen_model_name)
91
+
92
+ #Dataset
93
+ shosen_dataset_name = st.selectbox("Select the dataset to use", DATASETS, index=0)
94
+ if shosen_dataset_name is not None:
95
+ st.write("You selected", shosen_dataset_name)
96
+
97
+ #click to classify
98
+ #image_object = dataset['pasta'][0]
99
+ if chosen_model_name is not None and shosen_dataset_name is not None:
100
+ if st.button("Classify images"):
101
+
102
+ #classification_array =[]
103
+ classification_result = classify_full_dataset(shosen_dataset_name, chosen_model_name)
104
+ st.write(f"Classification result: {classification_result}")
105
+ #classification_array.append(classification_result)
106
+ #st.write("# FLAG 6")
107
+ #st.write(classification_array)
108
 
109
  if __name__ == "__main__":
110
  main()