Spaces:
Runtime error
Runtime error
RaulHuaroteZegarra
commited on
Commit
•
0ae3096
1
Parent(s):
735bbdf
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import pickle
|
2 |
from minisom import MiniSom
|
3 |
import numpy as np
|
4 |
-
import json
|
5 |
from fastapi import FastAPI, HTTPException
|
6 |
from pydantic import BaseModel
|
7 |
from typing import List
|
@@ -57,14 +56,14 @@ def redimensionar(img, h, v):
|
|
57 |
return cv2.resize(img, (h, v), interpolation=cv2.INTER_AREA)
|
58 |
|
59 |
def testeo(som,archivo):
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
|
69 |
som, MM = build_model() # Construir modelo
|
70 |
|
|
|
1 |
import pickle
|
2 |
from minisom import MiniSom
|
3 |
import numpy as np
|
|
|
4 |
from fastapi import FastAPI, HTTPException
|
5 |
from pydantic import BaseModel
|
6 |
from typing import List
|
|
|
56 |
return cv2.resize(img, (h, v), interpolation=cv2.INTER_AREA)
|
57 |
|
58 |
def testeo(som,archivo):
|
59 |
+
Xtest = redimensionar(archivo,256,256)
|
60 |
+
Xtest = np.array(Xtest)
|
61 |
+
Xtest = Xtest.astype('float32') / 255.0
|
62 |
+
Xtest = cv2.cvtColor(Xtest, cv2.COLOR_BGR2GRAY)
|
63 |
+
orientaciones = orientacion(Xtest, w=14)
|
64 |
+
orientaciones = orientaciones.reshape(-1)
|
65 |
+
Xtest = np.concatenate([orientaciones.ravel()])
|
66 |
+
return som.winner(Xtest)
|
67 |
|
68 |
som, MM = build_model() # Construir modelo
|
69 |
|