Nuno-Tome commited on
Commit
b4a533c
1 Parent(s): 2c39f53
Files changed (1) hide show
  1. app.py +39 -32
app.py CHANGED
@@ -15,6 +15,9 @@ DATASETS = [
15
  MAX_N_LABELS = 5
16
  SPLIT_TO_CLASSIFY = 'pasta'
17
  COL1, COL2 = st.columns([3, 1])
 
 
 
18
 
19
 
20
  #(image_object, classifier_pipeline)
@@ -74,43 +77,47 @@ def classify_full_dataset(shosen_dataset_name, chosen_model_name):
74
  return image_count
75
 
76
  def main():
77
- st.title("Bulk Image Classification DEMO")
 
 
78
 
79
 
80
  # Restart or reset your app
81
  # if st.button("Restart"):
82
  # # Code to restart or reset your app goes here
83
- # import subprocess
84
- # subprocess.call(["shutdown", "-r", "-t", "0"])
85
-
86
-
87
- with COL1:
88
- st.markdown("This app uses several 🤗 models to classify images stored in 🤗 datasets.")
89
- st.write("Soon we will have a dataset template")
90
-
91
-
92
-
93
- #Model
94
- chosen_model_name = st.selectbox("Select the model to use", MODELS, index=0)
95
- if chosen_model_name is not None:
96
- st.write("You selected", chosen_model_name)
97
-
98
- #Dataset
99
- shosen_dataset_name = st.selectbox("Select the dataset to use", DATASETS, index=0)
100
- if shosen_dataset_name is not None:
101
- st.write("You selected", shosen_dataset_name)
102
-
103
- #click to classify
104
- #image_object = dataset['pasta'][0]
105
- if chosen_model_name is not None and shosen_dataset_name is not None:
106
- if st.button("Classify images"):
107
-
108
- #classification_array =[]
109
- classification_result = classify_full_dataset(shosen_dataset_name, chosen_model_name)
110
- st.write(f"Classification result: {classification_result}")
111
- #classification_array.append(classification_result)
112
- #st.write("# FLAG 6")
113
- #st.write(classification_array)
 
 
114
 
115
  if __name__ == "__main__":
116
  main()
 
15
  MAX_N_LABELS = 5
16
  SPLIT_TO_CLASSIFY = 'pasta'
17
  COL1, COL2 = st.columns([3, 1])
18
+ CONTAINER_TOP = st.container()
19
+ CONTAINER_BODY = st.container()
20
+
21
 
22
 
23
  #(image_object, classifier_pipeline)
 
77
  return image_count
78
 
79
  def main():
80
+
81
+ with CONTAINER_TOP:
82
+ st.title("Bulk Image Classification DEMO")
83
 
84
 
85
  # Restart or reset your app
86
  # if st.button("Restart"):
87
  # # Code to restart or reset your app goes here
88
+ # import subprocess
89
+ # subprocess.call(["shutdown", "-r", "-t", "0"])
90
+ CONTAINER_BODY = st.container():
91
+
92
+
93
+
94
+ with COL1:
95
+ st.markdown("This app uses several 🤗 models to classify images stored in 🤗 datasets.")
96
+ st.write("Soon we will have a dataset template")
97
+
98
+
99
+
100
+ #Model
101
+ chosen_model_name = st.selectbox("Select the model to use", MODELS, index=0)
102
+ if chosen_model_name is not None:
103
+ st.write("You selected", chosen_model_name)
104
+
105
+ #Dataset
106
+ shosen_dataset_name = st.selectbox("Select the dataset to use", DATASETS, index=0)
107
+ if shosen_dataset_name is not None:
108
+ st.write("You selected", shosen_dataset_name)
109
+
110
+ #click to classify
111
+ #image_object = dataset['pasta'][0]
112
+ if chosen_model_name is not None and shosen_dataset_name is not None:
113
+ if st.button("Classify images"):
114
+
115
+ #classification_array =[]
116
+ classification_result = classify_full_dataset(shosen_dataset_name, chosen_model_name)
117
+ st.write(f"Classification result: {classification_result}")
118
+ #classification_array.append(classification_result)
119
+ #st.write("# FLAG 6")
120
+ #st.write(classification_array)
121
 
122
  if __name__ == "__main__":
123
  main()