Spaces:
Sleeping
Sleeping
COmmit on endpoint
Browse files- __pycache__/resultview.cpython-311.pyc +0 -0
- __pycache__/similarity.cpython-311.pyc +0 -0
- app.py +10 -4
- resultview.py +3 -6
- similarity.py +1 -1
__pycache__/resultview.cpython-311.pyc
CHANGED
|
Binary files a/__pycache__/resultview.cpython-311.pyc and b/__pycache__/resultview.cpython-311.pyc differ
|
|
|
__pycache__/similarity.cpython-311.pyc
CHANGED
|
Binary files a/__pycache__/similarity.cpython-311.pyc and b/__pycache__/similarity.cpython-311.pyc differ
|
|
|
app.py
CHANGED
|
@@ -6,10 +6,16 @@ import uvicorn
|
|
| 6 |
app = FastAPI()
|
| 7 |
|
| 8 |
|
| 9 |
-
app.
|
| 10 |
-
async def predict(id):
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
if __name__ =="__main__":
|
|
|
|
| 15 |
uvicorn.run(app,host = "127.0.0.1", port=7860)
|
|
|
|
| 6 |
app = FastAPI()
|
| 7 |
|
| 8 |
|
| 9 |
+
@app.get("/predict/")
|
| 10 |
+
async def predict(id:str):
|
| 11 |
+
try:
|
| 12 |
+
print("Peticion recibida")
|
| 13 |
+
tenant_list = rv.algo_start(int(id))
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
except Exception as error:
|
| 17 |
+
return {"prediction" : error}
|
| 18 |
|
| 19 |
if __name__ =="__main__":
|
| 20 |
+
|
| 21 |
uvicorn.run(app,host = "127.0.0.1", port=7860)
|
resultview.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import pandas as pd
|
|
|
|
| 2 |
|
| 3 |
def tenant_visualization(similarity_matrix, requested_tenants):
|
| 4 |
#TODO VIEW COMPATIBILITY BETWEEN REQUESTED TENANTS
|
|
@@ -25,14 +26,10 @@ def tenant_visualization(similarity_matrix, requested_tenants):
|
|
| 25 |
|
| 26 |
case 4:
|
| 27 |
most_compatible = tenant_lines.sort_values(ascending = False)
|
| 28 |
-
|
| 29 |
print(f"Most compatible tenants registers\n {most_compatible}")
|
| 30 |
|
| 31 |
-
|
| 32 |
-
# TODO FUNCTION TO VIEW KMEANS RESULTS
|
| 33 |
-
print(f"Starting kmeans viewing \n Cluster length: {results.shape}")
|
| 34 |
-
plt.scatter(results,results)
|
| 35 |
-
plt.show()
|
| 36 |
|
| 37 |
def tenant_inference(similarity_matrix, requested_tenants,dataframe):
|
| 38 |
#TODO THIS FUNCTION IS THE ONE USED DURING INFERENCE TIME THE MODEL WILL CALCULATE THE 4 TENANTS WITH THE HIGHER COMPATIBILITY
|
|
|
|
| 1 |
import pandas as pd
|
| 2 |
+
import similarity as sm
|
| 3 |
|
| 4 |
def tenant_visualization(similarity_matrix, requested_tenants):
|
| 5 |
#TODO VIEW COMPATIBILITY BETWEEN REQUESTED TENANTS
|
|
|
|
| 26 |
|
| 27 |
case 4:
|
| 28 |
most_compatible = tenant_lines.sort_values(ascending = False)
|
| 29 |
+
|
| 30 |
print(f"Most compatible tenants registers\n {most_compatible}")
|
| 31 |
|
| 32 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
def tenant_inference(similarity_matrix, requested_tenants,dataframe):
|
| 35 |
#TODO THIS FUNCTION IS THE ONE USED DURING INFERENCE TIME THE MODEL WILL CALCULATE THE 4 TENANTS WITH THE HIGHER COMPATIBILITY
|
similarity.py
CHANGED
|
@@ -3,7 +3,7 @@ from sklearn.preprocessing import OneHotEncoder
|
|
| 3 |
import pandas as pd
|
| 4 |
|
| 5 |
def data_preparing():
|
| 6 |
-
original_dataframe = pd.read_csv('./
|
| 7 |
columns = ['Age', 'Worktimes', 'Schedules', 'Studies level', 'Pets', 'Cooking', 'Sport', 'Smoking', 'Organized']
|
| 8 |
dataframe = original_dataframe[columns]
|
| 9 |
return dataframe, original_dataframe
|
|
|
|
| 3 |
import pandas as pd
|
| 4 |
|
| 5 |
def data_preparing():
|
| 6 |
+
original_dataframe = pd.read_csv('./data/users_dataframe.csv')
|
| 7 |
columns = ['Age', 'Worktimes', 'Schedules', 'Studies level', 'Pets', 'Cooking', 'Sport', 'Smoking', 'Organized']
|
| 8 |
dataframe = original_dataframe[columns]
|
| 9 |
return dataframe, original_dataframe
|