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