Spaces:
Build error
Build error
no message
Browse files
app.py
CHANGED
|
@@ -64,7 +64,7 @@ def classify_full_dataset(shosen_dataset_name, chosen_model_name):
|
|
| 64 |
|
| 65 |
#dataset
|
| 66 |
dataset = load_dataset(shosen_dataset_name,"testedata_readme")
|
| 67 |
-
with
|
| 68 |
#Image teste load
|
| 69 |
image_object = dataset['pasta'][0]["image"]
|
| 70 |
st.image(image_object, caption="Uploaded Image", width=300)
|
|
@@ -72,18 +72,18 @@ def classify_full_dataset(shosen_dataset_name, chosen_model_name):
|
|
| 72 |
|
| 73 |
#modle instance
|
| 74 |
classifier_pipeline = pipeline('image-classification', model=chosen_model_name)
|
| 75 |
-
|
| 76 |
|
| 77 |
#classification
|
| 78 |
classification_result = classifier_pipeline(image_object)
|
| 79 |
-
|
| 80 |
-
|
| 81 |
#classification_array.append(classification_result)
|
| 82 |
|
| 83 |
#save classification
|
| 84 |
|
| 85 |
image_count += 1
|
| 86 |
-
|
| 87 |
|
| 88 |
return image_count
|
| 89 |
|
|
@@ -105,10 +105,10 @@ def main():
|
|
| 105 |
|
| 106 |
make_template()
|
| 107 |
|
| 108 |
-
with CONTAINER_TOP:
|
| 109 |
-
|
| 110 |
|
| 111 |
-
|
| 112 |
# TODO Restart or reset your app
|
| 113 |
# if st.button("Restart"):
|
| 114 |
# # Code to restart or reset your app goes here
|
|
@@ -116,7 +116,7 @@ def main():
|
|
| 116 |
# subprocess.call(["shutdown", "-r", "-t", "0"])
|
| 117 |
|
| 118 |
#with CONTAINER_BODY:
|
| 119 |
-
with
|
| 120 |
st.markdown("This app uses several 🤗 models to classify images stored in 🤗 datasets.")
|
| 121 |
st.write("Soon we will have a dataset template")
|
| 122 |
|
|
@@ -137,9 +137,9 @@ def main():
|
|
| 137 |
|
| 138 |
#classification_array =[]
|
| 139 |
classification_result = classify_full_dataset(shosen_dataset_name, chosen_model_name)
|
| 140 |
-
|
| 141 |
#classification_array.append(classification_result)
|
| 142 |
#st.write("# FLAG 6")
|
| 143 |
-
#st.write(classification_array)
|
| 144 |
if __name__ == "__main__":
|
| 145 |
main()
|
|
|
|
| 64 |
|
| 65 |
#dataset
|
| 66 |
dataset = load_dataset(shosen_dataset_name,"testedata_readme")
|
| 67 |
+
with COLS[1]:
|
| 68 |
#Image teste load
|
| 69 |
image_object = dataset['pasta'][0]["image"]
|
| 70 |
st.image(image_object, caption="Uploaded Image", width=300)
|
|
|
|
| 72 |
|
| 73 |
#modle instance
|
| 74 |
classifier_pipeline = pipeline('image-classification', model=chosen_model_name)
|
| 75 |
+
COLS[1].write("### FLAG 4")
|
| 76 |
|
| 77 |
#classification
|
| 78 |
classification_result = classifier_pipeline(image_object)
|
| 79 |
+
COLS[1].write(classification_result)
|
| 80 |
+
COLS[1].write("### FLAG 5")
|
| 81 |
#classification_array.append(classification_result)
|
| 82 |
|
| 83 |
#save classification
|
| 84 |
|
| 85 |
image_count += 1
|
| 86 |
+
COLS[1].write(f"Image count: {image_count}")
|
| 87 |
|
| 88 |
return image_count
|
| 89 |
|
|
|
|
| 105 |
|
| 106 |
make_template()
|
| 107 |
|
| 108 |
+
# with CONTAINER_TOP:
|
| 109 |
+
# st.write("# Bulk Image Classification DEMO")
|
| 110 |
|
| 111 |
+
COLS[0].write("# Bulk Image Classification DEMO")
|
| 112 |
# TODO Restart or reset your app
|
| 113 |
# if st.button("Restart"):
|
| 114 |
# # Code to restart or reset your app goes here
|
|
|
|
| 116 |
# subprocess.call(["shutdown", "-r", "-t", "0"])
|
| 117 |
|
| 118 |
#with CONTAINER_BODY:
|
| 119 |
+
with COLS[0]:
|
| 120 |
st.markdown("This app uses several 🤗 models to classify images stored in 🤗 datasets.")
|
| 121 |
st.write("Soon we will have a dataset template")
|
| 122 |
|
|
|
|
| 137 |
|
| 138 |
#classification_array =[]
|
| 139 |
classification_result = classify_full_dataset(shosen_dataset_name, chosen_model_name)
|
| 140 |
+
COLS[0].write(f"Classification result: {classification_result}")
|
| 141 |
#classification_array.append(classification_result)
|
| 142 |
#st.write("# FLAG 6")
|
| 143 |
+
#st.write(classification_array)
|
| 144 |
if __name__ == "__main__":
|
| 145 |
main()
|