Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,27 +2,37 @@ import numpy as np
|
|
2 |
import pandas as pd
|
3 |
import matplotlib.pyplot as plt
|
4 |
import warnings
|
5 |
-
|
6 |
from sklearn.model_selection import train_test_split
|
7 |
-
from sklearn.
|
8 |
from sklearn.metrics import mean_squared_error, r2_score
|
9 |
from sklearn.compose import ColumnTransformer
|
10 |
-
from sklearn.preprocessing import StandardScaler
|
11 |
from sklearn.pipeline import Pipeline
|
12 |
-
|
13 |
-
warnings.filterwarnings('ignore')
|
14 |
|
15 |
# Veri okuma
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
return df
|
21 |
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
# Veri setini özellikler ve hedef olarak ayırma
|
25 |
-
y = df
|
26 |
X = df.drop(['fail'], axis=1)
|
27 |
|
28 |
# Eğitim ve test kümelerine ayırma
|
@@ -61,7 +71,7 @@ def fail(footfall, atemp, selfLR, ClinLR, DoleLR, PID, outpressure, inpressure,
|
|
61 |
prediction = pipe.predict(input_data)[0]
|
62 |
return prediction
|
63 |
|
64 |
-
st.title("İot Analizi :information: @
|
65 |
st.write("Lütfen Sensör Verilerini Giriniz.")
|
66 |
footfall = st.number_input("Footfall", 0, 10000)
|
67 |
atemp = st.number_input("Atemp", 0, 100)
|
@@ -75,5 +85,4 @@ temp = st.number_input("Temp", 0, 100)
|
|
75 |
|
76 |
if st.button("Predict"):
|
77 |
pred = fail(footfall, atemp, selfLR, ClinLR, DoleLR, PID, outpressure, inpressure, temp)
|
78 |
-
|
79 |
-
st.write("Sensör Durumu", abs(int(pred)))
|
|
|
2 |
import pandas as pd
|
3 |
import matplotlib.pyplot as plt
|
4 |
import warnings
|
5 |
+
warnings.filterwarnings('ignore')
|
6 |
from sklearn.model_selection import train_test_split
|
7 |
+
from sklearn.linearRegression import LinearRegression
|
8 |
from sklearn.metrics import mean_squared_error, r2_score
|
9 |
from sklearn.compose import ColumnTransformer
|
10 |
+
from sklearn.preprocessing import OneHotEncoder, StandardScaler
|
11 |
from sklearn.pipeline import Pipeline
|
12 |
+
import streamlit as st
|
|
|
13 |
|
14 |
# Veri okuma
|
15 |
+
df = pd.read_excel('iot predictive analysis.xlsx')
|
16 |
+
|
17 |
+
# Sütun isimlerindeki boşlukları temizleme
|
18 |
+
df.columns = df.columns.str.strip()
|
|
|
19 |
|
20 |
+
# Değişkenlerin açıklaması
|
21 |
+
columns_dict = {
|
22 |
+
'footfall': 'Belirli bir süre boyunca bir alandan geçen kişi sayısı.',
|
23 |
+
'atemp': 'Sensörün bulunduğu alanın dış ortam sıcaklığı.',
|
24 |
+
'selfLR': 'Bir cihazın kendi içindeki yük direnci.',
|
25 |
+
'ClinLR': 'Belirli bir klinik ortamda kullanılan yük direnci.',
|
26 |
+
'DoleLR': 'Belirli bir alandaki yük direnci.',
|
27 |
+
'PID': 'Orantısal, integral ve türev kontrol sistemi değeri.',
|
28 |
+
'outpressure': 'Cihazın dış ortam basıncı.',
|
29 |
+
'inpressure': 'Cihazın iç ortam basıncı.',
|
30 |
+
'temp': 'Genel ortam sıcaklığı.',
|
31 |
+
'fail': 'Cihazın arıza durumu.'
|
32 |
+
}
|
33 |
|
34 |
# Veri setini özellikler ve hedef olarak ayırma
|
35 |
+
y = df.fail
|
36 |
X = df.drop(['fail'], axis=1)
|
37 |
|
38 |
# Eğitim ve test kümelerine ayırma
|
|
|
71 |
prediction = pipe.predict(input_data)[0]
|
72 |
return prediction
|
73 |
|
74 |
+
st.title("İot Analizi :information: @dryed")
|
75 |
st.write("Lütfen Sensör Verilerini Giriniz.")
|
76 |
footfall = st.number_input("Footfall", 0, 10000)
|
77 |
atemp = st.number_input("Atemp", 0, 100)
|
|
|
85 |
|
86 |
if st.button("Predict"):
|
87 |
pred = fail(footfall, atemp, selfLR, ClinLR, DoleLR, PID, outpressure, inpressure, temp)
|
88 |
+
st.write("Sensör durumu: ", pred)
|
|