Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,6 @@ import torch.cuda
|
|
4 |
import whisper
|
5 |
from whisper.tokenizer import LANGUAGES
|
6 |
from vid_to_wav import extract_audio
|
7 |
-
from face_emotion_detection import process_video
|
8 |
gpu = torch.cuda.is_available()
|
9 |
model = None
|
10 |
|
@@ -27,14 +26,13 @@ def analyze_transcription(text, duration):
|
|
27 |
|
28 |
def transcribe(filepath, language, task):
|
29 |
print(filepath)
|
30 |
-
video = process_video(filepath)
|
31 |
audio, audio_file, duration = extract_audio(filepath)
|
32 |
print(type)
|
33 |
language = None if language == "Detect" else language
|
34 |
text = model.transcribe(
|
35 |
audio_file, task=task.lower(), language=language, fp16=gpu,
|
36 |
)["text"].strip()
|
37 |
-
return
|
38 |
|
39 |
|
40 |
def get_interface(model_name="medium"):
|
@@ -59,7 +57,7 @@ def get_interface(model_name="medium"):
|
|
59 |
info="Whether to perform X->X speech recognition or X->English translation",
|
60 |
),
|
61 |
],
|
62 |
-
outputs=[
|
63 |
gr.Textbox(label="Transcription", lines=26),
|
64 |
gr.Textbox(label="Speech Analysis", lines=4)],
|
65 |
# theme=gr.themes.Default(),
|
|
|
4 |
import whisper
|
5 |
from whisper.tokenizer import LANGUAGES
|
6 |
from vid_to_wav import extract_audio
|
|
|
7 |
gpu = torch.cuda.is_available()
|
8 |
model = None
|
9 |
|
|
|
26 |
|
27 |
def transcribe(filepath, language, task):
|
28 |
print(filepath)
|
|
|
29 |
audio, audio_file, duration = extract_audio(filepath)
|
30 |
print(type)
|
31 |
language = None if language == "Detect" else language
|
32 |
text = model.transcribe(
|
33 |
audio_file, task=task.lower(), language=language, fp16=gpu,
|
34 |
)["text"].strip()
|
35 |
+
return text, analyze_transcription(text, duration)
|
36 |
|
37 |
|
38 |
def get_interface(model_name="medium"):
|
|
|
57 |
info="Whether to perform X->X speech recognition or X->English translation",
|
58 |
),
|
59 |
],
|
60 |
+
outputs=[
|
61 |
gr.Textbox(label="Transcription", lines=26),
|
62 |
gr.Textbox(label="Speech Analysis", lines=4)],
|
63 |
# theme=gr.themes.Default(),
|