Spaces:
Runtime error
Runtime error
feat: add analyze_project and chat_with_llm services to api/services.py
Browse files- api/services.py +5 -2
api/services.py
CHANGED
|
@@ -209,12 +209,15 @@ def analyze_project(
|
|
| 209 |
top_projects = []
|
| 210 |
|
| 211 |
for _, row in results.iterrows():
|
|
|
|
|
|
|
|
|
|
| 212 |
top_projects.append({
|
| 213 |
"project_title": row.get("project_title", ""),
|
| 214 |
"matched_features": row.get("matched_features", []),
|
| 215 |
"unique_features": row.get("unique_query_features", []),
|
| 216 |
-
"similarity_score":
|
| 217 |
-
"final_originality_score":
|
| 218 |
})
|
| 219 |
|
| 220 |
# Overall = worst-case originality (against the most similar project)
|
|
|
|
| 209 |
top_projects = []
|
| 210 |
|
| 211 |
for _, row in results.iterrows():
|
| 212 |
+
orig_score = round(float(row.get("originality_score", 0)), 2)
|
| 213 |
+
sim_percent = round(100.0 - orig_score, 2)
|
| 214 |
+
|
| 215 |
top_projects.append({
|
| 216 |
"project_title": row.get("project_title", ""),
|
| 217 |
"matched_features": row.get("matched_features", []),
|
| 218 |
"unique_features": row.get("unique_query_features", []),
|
| 219 |
+
"similarity_score": sim_percent,
|
| 220 |
+
"final_originality_score": orig_score
|
| 221 |
})
|
| 222 |
|
| 223 |
# Overall = worst-case originality (against the most similar project)
|