File size: 1,426 Bytes
377dfb9
ae2b300
377dfb9
 
ae2b300
 
377dfb9
 
 
 
 
 
ae2b300
377dfb9
 
ae2b300
377dfb9
 
 
 
ae2b300
 
377dfb9
 
 
 
47c7d34
a6096bc
e645ade
 
fd7462a
377dfb9
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
import pandas as pd
import gradio as gr
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import train_test_split


def fault_predictor(mean, variance, kurtosis):
    df = pd.read_csv('final_feat_xtract.csv')
    X = df[['Mean', 'Variance', 'Kurtosis']]
    y = df['Condition']
    X_train, _, y_train, _ = train_test_split(
        X, y, test_size=0.2, random_state=42)

    model = DecisionTreeClassifier()
    model.fit(X_train, y_train)

    user_input_df = pd.DataFrame(
        {'Mean': [mean], 'Variance': [variance], 'Kurtosis': [kurtosis]})
    prediction = model.predict(user_input_df)
    return prediction[0]


iface = gr.Interface(fn=fault_predictor,
                     inputs=["number", "number", "number"],
                     outputs=gr.Textbox(label="Condition of the Machine"),
                     title="MACHINE CONDITION DETECTION - AN EDSP END SEM PROJECT",
                     description="This is an END to END EMBEDDED DIGITAL SIGNAL PROCESSING project done to predict the condition of the motor by giving the inputs in the prompt. \n\n"
                     "This fault detection project has been deployed and hosted to showcase the main objective of the condition of the machine whether it is in a healthy or in an unhealthy condition. \n\n"
                     "DEPLOYMENT TOOL: GRADIO \n\n"
                     "HOST: HUUGING FACE \n\n")

iface.launch(share=True)