Spaces:
Sleeping
Sleeping
Update video_processing.py
Browse files- video_processing.py +6 -3
video_processing.py
CHANGED
@@ -21,6 +21,7 @@ processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")
|
|
21 |
|
22 |
def classify_frame(frame):
|
23 |
categories = ["Joy", "Trust", "Fear", "Surprise", "Sadness", "Disgust", "Anger", "Anticipation"]
|
|
|
24 |
# Load ResNet-50 model
|
25 |
resnet50 = models.resnet50(pretrained=True)
|
26 |
resnet50.eval().to(device)
|
@@ -40,9 +41,11 @@ def classify_frame(frame):
|
|
40 |
output = resnet50(input_batch)
|
41 |
probabilities = F.softmax(output[0], dim=0)
|
42 |
|
43 |
-
#
|
44 |
-
|
45 |
-
|
|
|
|
|
46 |
|
47 |
|
48 |
def download_video(url):
|
|
|
21 |
|
22 |
def classify_frame(frame):
|
23 |
categories = ["Joy", "Trust", "Fear", "Surprise", "Sadness", "Disgust", "Anger", "Anticipation"]
|
24 |
+
|
25 |
# Load ResNet-50 model
|
26 |
resnet50 = models.resnet50(pretrained=True)
|
27 |
resnet50.eval().to(device)
|
|
|
41 |
output = resnet50(input_batch)
|
42 |
probabilities = F.softmax(output[0], dim=0)
|
43 |
|
44 |
+
# Create a numpy array from the probabilities of the categories
|
45 |
+
# This example assumes each category is mapped to a model output directly
|
46 |
+
results_array = np.array([probabilities[i].item() for i in range(len(categories))])
|
47 |
+
|
48 |
+
return results_array
|
49 |
|
50 |
|
51 |
def download_video(url):
|