File size: 624 Bytes
9839f56
eca5fdf
9839f56
eca5fdf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
import os

# Retrieve token securely from the environment
hf_token = os.environ.get("HF_TOKEN")

def preprocess_input(input_data):
    # Implement robust preprocessing logic here
    # Handle potential `None` values and ensure valid output
    # Refer to model documentation for specific requirements

    return preprocessed_data

# Load model with optional token
iface = gr.Blocks(
    preprocess_input,  # Use the improved preprocess function
    gr.load("models/pyannote/speaker-diarization-3.1", hf_token=hf_token),
)

# Launch interface
iface.launch(share=True)  # Set share=True for a public link