Initial commit
This commit is contained in:
12
app/model.py
Normal file
12
app/model.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from keras import models, layers
|
||||
import numpy as np
|
||||
|
||||
model = models.load_model("model/shape_model.keras")
|
||||
labels = ["circle ○", "rectangle ▭", "square □", "triangle △"]
|
||||
def run_model(image):
|
||||
img = np.expand_dims(image, axis=0)
|
||||
prediction = np.argmax(model.predict(img))
|
||||
return labels[prediction]
|
||||
|
||||
if __name__=="__main__":
|
||||
print(run_model(input("Image path: ")))
|
||||
Reference in New Issue
Block a user