Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -312,7 +312,7 @@ def query_embeddings(query_embedding, embeddings_data=None, n_results=5):
|
|
| 312 |
from sklearn.metrics.pairwise import cosine_similarity
|
| 313 |
import numpy as np
|
| 314 |
|
| 315 |
-
def query_recipes_embeddings(query_embedding
|
| 316 |
"""
|
| 317 |
Query the recipes embeddings to find the most similar recipes based on cosine similarity.
|
| 318 |
|
|
@@ -738,19 +738,6 @@ async def resources_endpoint(profile: MedicalProfile):
|
|
| 738 |
|
| 739 |
|
| 740 |
|
| 741 |
-
from fastapi import FastAPI, HTTPException
|
| 742 |
-
from pydantic import BaseModel
|
| 743 |
-
import pandas as pd
|
| 744 |
-
import numpy as np
|
| 745 |
-
from typing import Optional, List
|
| 746 |
-
|
| 747 |
-
app = FastAPI()
|
| 748 |
-
|
| 749 |
-
# Define your profile model for input data
|
| 750 |
-
class MedicalProfile(BaseModel):
|
| 751 |
-
conditions: str
|
| 752 |
-
daily_symptoms: str
|
| 753 |
-
|
| 754 |
@app.post("/api/recipes")
|
| 755 |
async def recipes_endpoint(profile: MedicalProfile):
|
| 756 |
try:
|
|
|
|
| 312 |
from sklearn.metrics.pairwise import cosine_similarity
|
| 313 |
import numpy as np
|
| 314 |
|
| 315 |
+
def query_recipes_embeddings(query_embedding, embeddings_data, n_results = 5):
|
| 316 |
"""
|
| 317 |
Query the recipes embeddings to find the most similar recipes based on cosine similarity.
|
| 318 |
|
|
|
|
| 738 |
|
| 739 |
|
| 740 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 741 |
@app.post("/api/recipes")
|
| 742 |
async def recipes_endpoint(profile: MedicalProfile):
|
| 743 |
try:
|