Update app/routes.py
Browse files- app/routes.py +0 -13
app/routes.py
CHANGED
|
@@ -6,7 +6,6 @@ from app.utils.ner import extract_ingredients
|
|
| 6 |
from app.utils.prediction import predict_with_description
|
| 7 |
from app.utils.recommendation import recommend_similar_products
|
| 8 |
from app.utils.helper import correct_spelling, load_data
|
| 9 |
-
from app.utils.predict_afteruse import predict_after_use, generate_afteruse_sentence_en, predict_after_use_with_probs
|
| 10 |
|
| 11 |
analyze_blueprint = Blueprint('analyze', __name__)
|
| 12 |
logging.basicConfig(level=logging.INFO)
|
|
@@ -78,22 +77,10 @@ def analyze_ingredients():
|
|
| 78 |
recommendations = recommend_similar_products(corrected, df_brand, product_embeddings)
|
| 79 |
logging.info(f"Product recommendations: {recommendations}")
|
| 80 |
|
| 81 |
-
# Predict combined after-use effects
|
| 82 |
-
logging.info("Predicting combined after-use effects")
|
| 83 |
-
combined_ingredients_str = " ".join(corrected)
|
| 84 |
-
after_use_predictions = predict_after_use(combined_ingredients_str)
|
| 85 |
-
after_use_sentence = generate_afteruse_sentence_en(after_use_predictions)
|
| 86 |
-
after_use_probs = predict_after_use_with_probs(combined_ingredients_str)
|
| 87 |
-
logging.info(f"After-use predictions: {after_use_predictions}")
|
| 88 |
|
| 89 |
return jsonify({
|
| 90 |
"Ingredient Analysis": results,
|
| 91 |
"Product Recommendations": recommendations,
|
| 92 |
-
"Predicted After Use Effects": {
|
| 93 |
-
"labels": after_use_predictions,
|
| 94 |
-
"description": after_use_sentence,
|
| 95 |
-
"skor": after_use_probs
|
| 96 |
-
}
|
| 97 |
})
|
| 98 |
|
| 99 |
except Exception as e:
|
|
|
|
| 6 |
from app.utils.prediction import predict_with_description
|
| 7 |
from app.utils.recommendation import recommend_similar_products
|
| 8 |
from app.utils.helper import correct_spelling, load_data
|
|
|
|
| 9 |
|
| 10 |
analyze_blueprint = Blueprint('analyze', __name__)
|
| 11 |
logging.basicConfig(level=logging.INFO)
|
|
|
|
| 77 |
recommendations = recommend_similar_products(corrected, df_brand, product_embeddings)
|
| 78 |
logging.info(f"Product recommendations: {recommendations}")
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
return jsonify({
|
| 82 |
"Ingredient Analysis": results,
|
| 83 |
"Product Recommendations": recommendations,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
})
|
| 85 |
|
| 86 |
except Exception as e:
|