File size: 805 Bytes
0cb486a
9876d02
0cb486a
3b25c9f
228a3b1
 
 
fc6dd1b
 
228a3b1
0cb486a
 
 
9876d02
 
228a3b1
 
9876d02
 
6d792ca
fc6dd1b
9876d02
 
80b7d93
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os
from gradio_client import Client, handle_file
from dotenv import load_dotenv

def transcriber(invideo_file:str, 
                max_words_per_line:int,
                task:str,
                model_version:str,
                device_type:str
                ):
        load_dotenv()
        HF_TOKEN = os.getenv("HF_TOKEN")
        HF_SPACE = os.getenv("HF_SPACE")
        client = Client(HF_SPACE, hf_token=HF_TOKEN)
        result = client.predict(
                file_input=handle_file(invideo_file),
                file_type = "video",
                max_words_per_line=max_words_per_line,
                task=task,
                model_version=model_version,
                device_type=device_type,
                api_name="/predict"
        )
        return result[0], result[3]