Spaces:
Sleeping
Sleeping
# model_3.py | |
import os | |
import cv2 | |
import numpy as np | |
import importlib.util | |
from PIL import Image | |
import gradio as gr | |
from common_detection import perform_detection | |
MODEL_DIR = 'model_3' | |
GRAPH_NAME = 'detect.tflite' | |
LABELMAP_NAME = 'labelmap.txt' | |
pkg = importlib.util.find_spec('tflite_runtime') | |
if pkg: | |
from tflite_runtime.interpreter import Interpreter | |
else: | |
from tensorflow.lite.python.interpreter import Interpreter | |
PATH_TO_CKPT = os.path.join(MODEL_DIR, GRAPH_NAME) | |
PATH_TO_LABELS = os.path.join(MODEL_DIR, LABELMAP_NAME) | |
with open(PATH_TO_LABELS, ' | |