Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -16,18 +16,23 @@ os.environ["XDG_CONFIG_HOME"] = "/tmp"
|
|
16 |
import streamlit as st
|
17 |
|
18 |
|
19 |
-
hf_token = os.getenv("HF_token") # Match the exact name you set in the Secrets tab
|
20 |
|
21 |
# Example usage with requests
|
22 |
-
headers = {
|
23 |
-
|
24 |
-
}
|
25 |
|
26 |
# Example: Access a private file or API on Hugging Face
|
27 |
-
import requests
|
28 |
-
response = requests.get("https://huggingface.co/api/whoami-v2", headers=headers)
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
-
print(response.json())
|
31 |
|
32 |
|
33 |
|
@@ -68,7 +73,7 @@ if uploaded_file is not None:
|
|
68 |
break
|
69 |
|
70 |
processed = preprocess_frame(frame)
|
71 |
-
pred =
|
72 |
label = "Violent" if pred <= 0.5 else "Non-Violent"
|
73 |
color = (0, 0, 255) if label == "Violent" else (0, 255, 0)
|
74 |
|
|
|
16 |
import streamlit as st
|
17 |
|
18 |
|
19 |
+
#hf_token = os.getenv("HF_token") # Match the exact name you set in the Secrets tab
|
20 |
|
21 |
# Example usage with requests
|
22 |
+
#headers = {
|
23 |
+
# "Authorization": f"Bearer {hf_token}"
|
24 |
+
#}
|
25 |
|
26 |
# Example: Access a private file or API on Hugging Face
|
27 |
+
#import requests
|
28 |
+
#response = requests.get("https://huggingface.co/api/whoami-v2", headers=headers)
|
29 |
+
|
30 |
+
#print(response.json())
|
31 |
+
|
32 |
+
import os
|
33 |
+
token = os.getenv("app") # secure
|
34 |
+
|
35 |
|
|
|
36 |
|
37 |
|
38 |
|
|
|
73 |
break
|
74 |
|
75 |
processed = preprocess_frame(frame)
|
76 |
+
pred = run_prediction(model, processed)
|
77 |
label = "Violent" if pred <= 0.5 else "Non-Violent"
|
78 |
color = (0, 0, 255) if label == "Violent" else (0, 255, 0)
|
79 |
|