File size: 784 Bytes
9876d02
 
3b25c9f
228a3b1
 
 
 
 
 
9876d02
 
 
 
228a3b1
 
9876d02
 
6d792ca
9876d02
 
228a3b1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from gradio_client import Client, handle_file
from utils.api_configs import api_configs

def transcriber(invideo_file:str, 
                max_words_per_line:int,
                task:str,
                model_version:str,
                config_file:str
                ):
        HF_TOKEN = api_configs(config_file)["secrets"]["hf-token"]
        HF_SPACE = api_configs(config_file)["secrets"]["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,
                api_name="/predict"
        )
        return result[0]