Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ import subprocess
|
|
8 |
import moviepy.editor as mp
|
9 |
import base64
|
10 |
|
11 |
-
token = AutoTokenizer.from_pretrained('ProsusAI/finbert')
|
12 |
|
13 |
inf_session = onnxruntime.InferenceSession('classifier1-quantized.onnx')
|
14 |
input_name = inf_session.get_inputs()[0].name
|
@@ -23,7 +23,7 @@ pipe = pipeline("automatic-speech-recognition",
|
|
23 |
chunk_length_s=30, device=device)
|
24 |
|
25 |
### --- Text Summary --- ###
|
26 |
-
summarizer = pipeline("summarization", model="
|
27 |
|
28 |
|
29 |
def video_identity(video):
|
@@ -72,8 +72,8 @@ def classify(video_file,encoded_video):
|
|
72 |
sum = summary(full_text)[0]['summary_text']
|
73 |
|
74 |
|
75 |
-
input_ids = token(sum)['input_ids'][:512]
|
76 |
-
logits = inf_session.run([output_name],{input_name : [
|
77 |
logits = torch.FloatTensor(logits)
|
78 |
probs = torch.sigmoid(logits)[0]
|
79 |
probs = list(probs)
|
|
|
8 |
import moviepy.editor as mp
|
9 |
import base64
|
10 |
|
11 |
+
# token = AutoTokenizer.from_pretrained('ProsusAI/finbert')
|
12 |
|
13 |
inf_session = onnxruntime.InferenceSession('classifier1-quantized.onnx')
|
14 |
input_name = inf_session.get_inputs()[0].name
|
|
|
23 |
chunk_length_s=30, device=device)
|
24 |
|
25 |
### --- Text Summary --- ###
|
26 |
+
summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6", device=device)
|
27 |
|
28 |
|
29 |
def video_identity(video):
|
|
|
72 |
sum = summary(full_text)[0]['summary_text']
|
73 |
|
74 |
|
75 |
+
# input_ids = token(sum)['input_ids'][:512]
|
76 |
+
logits = inf_session.run([output_name],{input_name : [sum]})[0]
|
77 |
logits = torch.FloatTensor(logits)
|
78 |
probs = torch.sigmoid(logits)[0]
|
79 |
probs = list(probs)
|