Spaces:
Runtime error
Runtime error
Create Attempt_2
#1
by samjakejersie - opened
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455import gradio as grimport numpy as np
from datasets import load_dataset
import ioimport pickleimport requestsimport urllib.requestimport shutil
import pandas as pd from pycaret.regression import *
GE_url = 'https://github.com/GEProject/GEProject/blob/main/Full_Data_Cleaned.csv'download = requests.get(GE_url).content
def predict(dist, flight_cycle, t50_max, nc_avg, ps30_max, nrc_max, bpr_max, w32_avg): df = pd.DataFrame.from_dict({ 'dist': [dist], 'flight_cycle': [flight_cycle], 't50_max': [t50_max], 'nc_avg': [nc_avg], 'ps30_max': [ps30_max], 'nrc_max': [nrc_max], 'bpr_max': [bpr_max], 'w32_avg': [w32_avg] }) with urllib.request.urlopen('https://github.com/GEProject/GEProject/blob/main/final_model.pkl?raw=true') as response, open('final_model.pkl', 'wb') as out_file: shutil.copyfileobj(response, out_file) model = load_model('final_model') pred = predict_model(model)
return {'RUL': pred['Label']} # Defining containers for each input dist = gr.inputs.Number()flight_cycle = gr.inputs.Number()t50_max = gr.inputs.Number()nc_avg = gr.inputs.Number()ps30_max = gr.inputs.Number()nrc_max = gr.inputs.Number()bpr_max = gr.inputs.Number()w32_avg = gr.inputs.Number()
gr.Interface(predict, [dist, flight_cycle, t50_max, nc_avg, ps30_max, nrc_max, bpr_max, w32_avg], 'number', live=True, title = "Predicting Remaining Useful Life Using AdaBoost Regressor", description = "description test", css = 'https://bootswatch.com/5/journal/bootstrap.css').launch(debug = False);Attempt_2Added+55