-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp_rock_mine.py
More file actions
39 lines (30 loc) · 983 Bytes
/
Copy pathapp_rock_mine.py
File metadata and controls
39 lines (30 loc) · 983 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# -*- coding: utf-8 -*-
"""app_Rock_mine.ipynb
Automatically generated by Colab.
Original file is located at
https://colab.research.google.com/drive/19cYlXu5oldZgmQpFmr4N9JapuvWklFN6
"""
import streamlit as st
import numpy as np
import pickle
# Load the trained model
with open('model1 (1).pkl', 'rb') as file:
model = pickle.load(file)
# Title
st.title("Rock vs Mine Prediction App")
st.markdown("""
Please enter the 60 sonar signal values (range: 0.0 to 1.0) below to predict whether the object is a **Rock** or a **Mine**.
""")
# Input fields
input_data = []
for i in range(60):
value = st.number_input(f"Feature {i+1}", min_value=0.0, max_value=1.0, step=0.01, value=0.5, key=i)
input_data.append(value)
# Predict button
if st.button("Predict"):
input_array = np.array(input_data).reshape(1, -1)
prediction = model.predict(input_array)[0]
if prediction == 1:
st.write("Prediction: Mine")
else:
st.write("Prediction: Rock")