Download app.py from simran19/iris: direct link, hf CLI and curl.
- Browser
- Download file 854 Bytes
-
https://huggingface.co/spaces/simran19/iris/resolve/main/app.py
- Command line
-
hf download hf://spaces/simran19/iris/app.py
-
curl -L -o app.py https://huggingface.co/spaces/simran19/iris/resolve/main/app.py
854 Bytes
| from flask import Flask,render_template,request | |
| import joblib | |
| from sklearn.linear_model import LogisticRegression | |
| app=Flask(__name__) | |
| #predicting using saved model | |
| model=joblib.load('iris_model.pkl') | |
| def home(): | |
| return render_template('index.html') | |
| def predict(): | |
| # Get form values and convert them to float | |
| sepal_length = float(request.form['sl']) | |
| sepal_width = float(request.form['sw']) | |
| petal_length = float(request.form['pl']) | |
| petal_width = float(request.form['pw']) | |
| # Make prediction | |
| prediction = model.predict([[sepal_length, sepal_width, petal_length, petal_width]]) | |
| result = prediction[0] | |
| return render_template('index.html', result=result) | |
| if __name__ == '__main__': | |
| app.run(debug=True, host='0.0.0.0') |