Spaces:
Runtime error
Runtime error
Download app.py from Maneya/Weld_depth_width_prediction: direct link, hf CLI and curl.
- Browser
- Download file 946 Bytes
-
https://huggingface.co/spaces/Maneya/Weld_depth_width_prediction/resolve/main/app.py
- Command line
-
hf download hf://spaces/Maneya/Weld_depth_width_prediction/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Maneya/Weld_depth_width_prediction/resolve/main/app.py
946 Bytes
| import numpy as np | |
| import gradio as gr | |
| from sklearn.tree import DecisionTreeRegressor | |
| import pickle | |
| # from joblib import load | |
| tree_model = pickle.load(open('tree_model.pkl', 'rb')) | |
| # tree_model = load('tree_model.joblib') | |
| def predict(IW, IF, VW, FP): | |
| params = [[float(IW), float(IF), float(VW), float(FP)]] | |
| prediction = np.round(tree_model.predict(params), 2) | |
| depth, width = prediction[0] | |
| print(depth, width) | |
| return depth, width | |
| input1 = gr.inputs.Slider(minimum=0, maximum=100, label="Input 1") | |
| input2 = gr.inputs.Slider(minimum=0, maximum=100, label="Input 2") | |
| input3 = gr.inputs.Slider(minimum=0, maximum=100, label="Input 3") | |
| input4 = gr.inputs.Slider(minimum=0, maximum=100, label="Input 4") | |
| output1 = gr.outputs.Textbox(label="Output") | |
| output2 = gr.outputs.Textbox(label="Output") | |
| interface = gr.Interface(fn=predict, inputs=[input1, input2, input3, input4], outputs=[output1, output2]) | |
| interface.launch(share=True) |