Spaces:
Sleeping
Sleeping
Update src/predict.py
Browse files- src/predict.py +1 -15
src/predict.py
CHANGED
|
@@ -2,21 +2,7 @@ from tensorflow.keras.models import load_model
|
|
| 2 |
|
| 3 |
#def load_trained_model(path):
|
| 4 |
#return load_model(path)
|
| 5 |
-
'''
|
| 6 |
-
import os
|
| 7 |
-
import urllib.request
|
| 8 |
-
from tensorflow.keras.models import load_model
|
| 9 |
|
| 10 |
-
def load_trained_model(path="violence_model.h5"):
|
| 11 |
-
url = "https://huggingface.co/spaces/muskan19/Violence_Detector/resolve/main/violence_model.h5"
|
| 12 |
-
|
| 13 |
-
if not os.path.exists(path):
|
| 14 |
-
print("Downloading model...")
|
| 15 |
-
urllib.request.urlretrieve(url, path)
|
| 16 |
-
print("Model downloaded.")
|
| 17 |
-
|
| 18 |
-
return load_model(path, compile=False)
|
| 19 |
-
'''
|
| 20 |
|
| 21 |
def run_prediction(model, processed_frame): # Renamed function
|
| 22 |
prediction = model.predict(processed_frame)
|
|
@@ -29,7 +15,7 @@ import urllib.request
|
|
| 29 |
from tensorflow.keras.models import load_model
|
| 30 |
|
| 31 |
def load_trained_model(path="violence_model.h5"):
|
| 32 |
-
url = "https://huggingface.co/spaces/muskan19/Violence_Detector/
|
| 33 |
|
| 34 |
if not os.path.exists(path):
|
| 35 |
print("Downloading model...")
|
|
|
|
| 2 |
|
| 3 |
#def load_trained_model(path):
|
| 4 |
#return load_model(path)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
def run_prediction(model, processed_frame): # Renamed function
|
| 8 |
prediction = model.predict(processed_frame)
|
|
|
|
| 15 |
from tensorflow.keras.models import load_model
|
| 16 |
|
| 17 |
def load_trained_model(path="violence_model.h5"):
|
| 18 |
+
url = "https://huggingface.co/spaces/muskan19/Violence_Detector/blob/main/violence_model.keras"
|
| 19 |
|
| 20 |
if not os.path.exists(path):
|
| 21 |
print("Downloading model...")
|