Spaces:
Sleeping
Sleeping
1st test
Browse files
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 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
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.
|
76 |
-
st.write("Soon we will have a dataset template")
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
|
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 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|