muskan19 commited on
Commit
3040f21
·
verified ·
1 Parent(s): 12d808d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -8
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
- "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
 
33
 
@@ -68,7 +73,7 @@ if uploaded_file is not None:
68
  break
69
 
70
  processed = preprocess_frame(frame)
71
- pred = predict_violence(model, processed)
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