bhuvaneshprasad
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,28 +1,27 @@
|
|
1 |
-
# streamlit_app/app.py
|
2 |
-
|
3 |
-
import streamlit as st
|
4 |
-
import requests
|
5 |
-
from PIL import Image
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
st.
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
image = Image
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
main()
|
|
|
1 |
+
# streamlit_app/app.py
|
2 |
+
from prediction import PredictionPipeline
|
3 |
+
import streamlit as st
|
4 |
+
import requests
|
5 |
+
from PIL import Image
|
6 |
+
|
7 |
+
def main():
|
8 |
+
st.title("SETI Signals Classifier")
|
9 |
+
|
10 |
+
# Example: Upload file and send POST request to FastAPI endpoint
|
11 |
+
uploaded_file = st.file_uploader("Choose an image to predict...", type=["png"])
|
12 |
+
st.markdown("You can get sample images from [here](https://github.com/bhuvaneshprasad/End-to-End-SETI-Classification-using-CNN-MLFlow-DVC/tree/main/assets/test_images) to predict.")
|
13 |
+
if uploaded_file is not None:
|
14 |
+
with st.spinner('Predicting...'):
|
15 |
+
files = {"file": uploaded_file}
|
16 |
+
predictor = PredictionPipeline(files)
|
17 |
+
prediction = predictor.predict()
|
18 |
+
st.title(type(prediction))
|
19 |
+
if type(prediction) == str:
|
20 |
+
st.json({'prediction' : prediction})
|
21 |
+
image = Image.open(uploaded_file)
|
22 |
+
st.image(image, caption="Uploaded Image", use_column_width=True)
|
23 |
+
else:
|
24 |
+
st.error("Failed to predict")
|
25 |
+
|
26 |
+
if __name__ == "__main__":
|
27 |
+
main()
|
|