Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,27 @@ import io
|
|
5 |
import numpy as np
|
6 |
from streamlit_option_menu import option_menu
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
def load_image():
|
9 |
uploaded_file = st.file_uploader(label='Pick an image to test')
|
10 |
if uploaded_file is not None:
|
@@ -42,7 +63,7 @@ def main():
|
|
42 |
with st.sidebar:
|
43 |
selected = option_menu(
|
44 |
menu_title="Main Menu",
|
45 |
-
options=["About", "
|
46 |
icons=["info-circle", "camera", "search", "clipboard-list"],
|
47 |
menu_icon="cast",
|
48 |
default_index=0,
|
@@ -61,8 +82,8 @@ def main():
|
|
61 |
400L
|
62 |
""")
|
63 |
|
64 |
-
elif selected == "
|
65 |
-
st.title('
|
66 |
st.write("This is a demo of an image classification model trained on the Oxford Flower Dataset.")
|
67 |
st.write("To test the model, upload an image of a flower and click the 'Run on image' button.")
|
68 |
|
@@ -77,8 +98,8 @@ def main():
|
|
77 |
st.markdown(f'<h4 style="color:blue;">Flower Type: <span style="color:black;">{flower}</span></h4>', unsafe_allow_html=True)
|
78 |
st.markdown(f'<h4 style="color:green;">Closeness: <span style="color:black;">{closeness}%</span></h4>', unsafe_allow_html=True)
|
79 |
|
80 |
-
elif selected == "
|
81 |
-
st.title('
|
82 |
st.write("This section will contain extensive classifier details and options.")
|
83 |
# Add your extensive classifier code here
|
84 |
|
|
|
5 |
import numpy as np
|
6 |
from streamlit_option_menu import option_menu
|
7 |
|
8 |
+
# Function to add a background image
|
9 |
+
def add_bg_from_local(image_path):
|
10 |
+
with open(image_path, "rb") as image_file:
|
11 |
+
encoded_string = base64.b64encode(image_file.read())
|
12 |
+
st.markdown(
|
13 |
+
f"""
|
14 |
+
<style>
|
15 |
+
.stApp {{
|
16 |
+
background-image: url("data:image/{"png"};base64,{encoded_string.decode()}");
|
17 |
+
background-size: cover;
|
18 |
+
background-repeat: no-repeat;
|
19 |
+
background-attachment: fixed;
|
20 |
+
}}
|
21 |
+
</style>
|
22 |
+
""",
|
23 |
+
unsafe_allow_html=True
|
24 |
+
)
|
25 |
+
|
26 |
+
# Add background image
|
27 |
+
add_bg_from_local('flower.png')
|
28 |
+
|
29 |
def load_image():
|
30 |
uploaded_file = st.file_uploader(label='Pick an image to test')
|
31 |
if uploaded_file is not None:
|
|
|
63 |
with st.sidebar:
|
64 |
selected = option_menu(
|
65 |
menu_title="Main Menu",
|
66 |
+
options=["About", "Local Classifier", "Extensive Classifier", "Project Details"],
|
67 |
icons=["info-circle", "camera", "search", "clipboard-list"],
|
68 |
menu_icon="cast",
|
69 |
default_index=0,
|
|
|
82 |
400L
|
83 |
""")
|
84 |
|
85 |
+
elif selected == "Local Classifier":
|
86 |
+
st.title('Local Classifier')
|
87 |
st.write("This is a demo of an image classification model trained on the Oxford Flower Dataset.")
|
88 |
st.write("To test the model, upload an image of a flower and click the 'Run on image' button.")
|
89 |
|
|
|
98 |
st.markdown(f'<h4 style="color:blue;">Flower Type: <span style="color:black;">{flower}</span></h4>', unsafe_allow_html=True)
|
99 |
st.markdown(f'<h4 style="color:green;">Closeness: <span style="color:black;">{closeness}%</span></h4>', unsafe_allow_html=True)
|
100 |
|
101 |
+
elif selected == "Extensive Classifier":
|
102 |
+
st.title('Extensive Classifier')
|
103 |
st.write("This section will contain extensive classifier details and options.")
|
104 |
# Add your extensive classifier code here
|
105 |
|