Spaces:
Build error
Build error
Download app.py from Rahul23232/irisclassprection: direct link, hf CLI and curl.
- Browser
- Download file 688 Bytes
-
https://huggingface.co/spaces/Rahul23232/irisclassprection/resolve/main/app.py
- Command line
-
hf download hf://spaces/Rahul23232/irisclassprection/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Rahul23232/irisclassprection/resolve/main/app.py
688 Bytes
| from flask import Flask, render_template, request | |
| from sklearn.linear_model import LogisticRegression | |
| import joblib | |
| app = Flask(__name__) | |
| # Load model | |
| model = joblib.load('iris_model1.joblib') | |
| def home(): | |
| return render_template('index.html') | |
| def predict(): | |
| sl = float(request.form['sepal_length']) | |
| sw = float(request.form['sepal_width']) | |
| pl = float(request.form['petal_length']) | |
| pw = float(request.form['petal_width']) | |
| # Predict species | |
| input_data = [[sl, sw, pl, pw]] | |
| pred = model.predict(input_data) | |
| return render_template('index.html', data=pred[0]) | |
| if __name__ == '__main__': | |
| app.run(debug=True) |