Spaces:
Running
Running
no message
Browse files
app.py
CHANGED
|
@@ -13,21 +13,33 @@ DATASETS = [
|
|
| 13 |
"Nunt/backup_leonardo_2024-02-01"
|
| 14 |
]
|
| 15 |
MAX_N_LABELS = 5
|
|
|
|
| 16 |
|
| 17 |
#(image_object, classifier_pipeline)
|
| 18 |
#def classify_one_image(classifier_model, dataset_to_classify):
|
|
|
|
| 19 |
def classify_one_image(classifier_model, dataset_to_classify):
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
return "done"
|
| 32 |
|
| 33 |
|
|
@@ -47,7 +59,7 @@ def classify_full_dataset(shosen_dataset_name, chosen_model_name):
|
|
| 47 |
st.write("### FLAG 4")
|
| 48 |
|
| 49 |
#classification
|
| 50 |
-
classification_result =
|
| 51 |
st.write(classification_result)
|
| 52 |
st.write("### FLAG 5")
|
| 53 |
#classification_array.append(classification_result)
|
|
|
|
| 13 |
"Nunt/backup_leonardo_2024-02-01"
|
| 14 |
]
|
| 15 |
MAX_N_LABELS = 5
|
| 16 |
+
SPLIT_TO_CLASSIFY = 'pasta'
|
| 17 |
|
| 18 |
#(image_object, classifier_pipeline)
|
| 19 |
#def classify_one_image(classifier_model, dataset_to_classify):
|
| 20 |
+
#classify_one_image(image_object, classifier_pipeline)
|
| 21 |
def classify_one_image(classifier_model, dataset_to_classify):
|
| 22 |
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
#image_object = dataset[SPLIT_TO_CLASSIFY][i]["image"]
|
| 26 |
+
#st.image(image_object, caption="Uploaded Image", width=300)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
#for i in range(len(dataset_to_classify)):
|
| 30 |
+
#for image in dataset_to_classify:
|
| 31 |
+
#image_object = dataset[SPLIT_TO_CLASSIFY][i]["image"]
|
| 32 |
+
#st.image(image_object, caption="Uploaded Image", width=300)
|
| 33 |
+
|
| 34 |
+
#st.write(f"Image classification: ", image['file'])
|
| 35 |
+
|
| 36 |
+
# image_path = image['file']
|
| 37 |
+
# img = Image.open(image_path)
|
| 38 |
+
# st.image(img, caption="Original image", use_column_width=True)
|
| 39 |
+
# results = classifier(image_path, top_k=MAX_N_LABELS)
|
| 40 |
+
# st.write(results)
|
| 41 |
+
# st.write("----")
|
| 42 |
+
|
| 43 |
return "done"
|
| 44 |
|
| 45 |
|
|
|
|
| 59 |
st.write("### FLAG 4")
|
| 60 |
|
| 61 |
#classification
|
| 62 |
+
classification_result = classifier_pipeline(image_object)
|
| 63 |
st.write(classification_result)
|
| 64 |
st.write("### FLAG 5")
|
| 65 |
#classification_array.append(classification_result)
|