Spaces:
Sleeping
Sleeping
test
Browse files
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 |
-
|
|
|
|
|
|
|
| 78 |
|
| 79 |
|
| 80 |
# Restart or reset your app
|
| 81 |
# if st.button("Restart"):
|
| 82 |
# # Code to restart or reset your app goes here
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
st.
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
st.
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
|
|
|
|
|
|
| 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()
|