Upload folder using huggingface_hub
Browse files
introvert_extrovert_predictor.py
CHANGED
|
@@ -8,6 +8,8 @@ app = Flask("Introvert Extrovert Predictor")
|
|
| 8 |
# Load the trained classification model
|
| 9 |
model = joblib.load("introvert_extrovert_predictor_v1_0.joblib")
|
| 10 |
|
|
|
|
|
|
|
| 11 |
# Home route
|
| 12 |
@app.get("/")
|
| 13 |
def home():
|
|
@@ -33,6 +35,10 @@ def predict_personality_single():
|
|
| 33 |
prediction = model.predict(input_df).tolist()[0]
|
| 34 |
personality = "Extrovert" if prediction == 0 else "Introvert"
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
return jsonify({'Predicted_Personality': personality})
|
| 37 |
|
| 38 |
@app.post("/v1/personality/predictbatch")
|
|
|
|
| 8 |
# Load the trained classification model
|
| 9 |
model = joblib.load("introvert_extrovert_predictor_v1_0.joblib")
|
| 10 |
|
| 11 |
+
api_hit_counter = 0
|
| 12 |
+
|
| 13 |
# Home route
|
| 14 |
@app.get("/")
|
| 15 |
def home():
|
|
|
|
| 35 |
prediction = model.predict(input_df).tolist()[0]
|
| 36 |
personality = "Extrovert" if prediction == 0 else "Introvert"
|
| 37 |
|
| 38 |
+
# Increment and print the counter
|
| 39 |
+
api_hit_counter += 1
|
| 40 |
+
print(f"API hit count: {api_hit_counter}")
|
| 41 |
+
|
| 42 |
return jsonify({'Predicted_Personality': personality})
|
| 43 |
|
| 44 |
@app.post("/v1/personality/predictbatch")
|