Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import streamlit as st
|
2 |
import numpy as np
|
3 |
from PIL import Image
|
@@ -33,7 +34,7 @@ st.title("Deep Prediction Hub")
|
|
33 |
st.sidebar.header("Options")
|
34 |
|
35 |
# Choose between tasks
|
36 |
-
task = st.sidebar.radio("Select Task", ("Sentiment Classification", "Tumor Detection"))
|
37 |
|
38 |
if task == "Sentiment Classification":
|
39 |
st.subheader("Sentiment Classification")
|
@@ -44,7 +45,7 @@ if task == "Sentiment Classification":
|
|
44 |
|
45 |
if new_review_text.strip():
|
46 |
st.subheader("Choose Model for Sentiment Classification")
|
47 |
-
model_option = st.selectbox("Select Model", ("Perceptron", "Backpropagation", "DNN", "RNN", "LSTM"))
|
48 |
|
49 |
# Load models dynamically based on the selected option
|
50 |
if model_option == "Perceptron":
|
@@ -80,21 +81,3 @@ elif task == "Tumor Detection":
|
|
80 |
st.subheader("Tumor Detection Result")
|
81 |
st.write(f"**{result}**")
|
82 |
|
83 |
-
result = sentiment_classification(new_review_text, model)
|
84 |
-
st.subheader("Sentiment Classification Result")
|
85 |
-
st.write(f"**{result}**")
|
86 |
-
|
87 |
-
elif task == "Tumor Detection":
|
88 |
-
st.subheader("Tumor Detection")
|
89 |
-
uploaded_file = st.file_uploader("Choose a tumor image...", type=["jpg", "jpeg", "png"])
|
90 |
-
|
91 |
-
if uploaded_file is not None:
|
92 |
-
# Load the tumor detection model
|
93 |
-
model = load_model('CN.h5')
|
94 |
-
st.image(uploaded_file, caption="Uploaded Image.", use_column_width=False, width=200)
|
95 |
-
st.write("")
|
96 |
-
|
97 |
-
if st.button("Detect Tumor"):
|
98 |
-
result = tumor_detection(uploaded_file, model)
|
99 |
-
st.subheader("Tumor Detection Result")
|
100 |
-
st.write(f"**{result}**")
|
|
|
1 |
+
|
2 |
import streamlit as st
|
3 |
import numpy as np
|
4 |
from PIL import Image
|
|
|
34 |
st.sidebar.header("Options")
|
35 |
|
36 |
# Choose between tasks
|
37 |
+
task = st.sidebar.radio("Select Task", ("Sentiment Classification", "Tumor Detection"), key="task_selection")
|
38 |
|
39 |
if task == "Sentiment Classification":
|
40 |
st.subheader("Sentiment Classification")
|
|
|
45 |
|
46 |
if new_review_text.strip():
|
47 |
st.subheader("Choose Model for Sentiment Classification")
|
48 |
+
model_option = st.selectbox("Select Model", ("Perceptron", "Backpropagation", "DNN", "RNN", "LSTM"), key="model_selection")
|
49 |
|
50 |
# Load models dynamically based on the selected option
|
51 |
if model_option == "Perceptron":
|
|
|
81 |
st.subheader("Tumor Detection Result")
|
82 |
st.write(f"**{result}**")
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|