Spaces:
Runtime error
Runtime error
prashant123
commited on
Commit
•
eca5fdf
1
Parent(s):
9839f56
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,21 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import os
|
3 |
|
4 |
+
# Retrieve token securely from the environment
|
5 |
+
hf_token = os.environ.get("HF_TOKEN")
|
6 |
+
|
7 |
+
def preprocess_input(input_data):
|
8 |
+
# Implement robust preprocessing logic here
|
9 |
+
# Handle potential `None` values and ensure valid output
|
10 |
+
# Refer to model documentation for specific requirements
|
11 |
+
|
12 |
+
return preprocessed_data
|
13 |
+
|
14 |
+
# Load model with optional token
|
15 |
+
iface = gr.Blocks(
|
16 |
+
preprocess_input, # Use the improved preprocess function
|
17 |
+
gr.load("models/pyannote/speaker-diarization-3.1", hf_token=hf_token),
|
18 |
+
)
|
19 |
+
|
20 |
+
# Launch interface
|
21 |
+
iface.launch(share=True) # Set share=True for a public link
|