Update app.py
Browse files
app.py
CHANGED
|
@@ -131,16 +131,18 @@ if uploaded_file:
|
|
| 131 |
|
| 132 |
# 1. Diarization
|
| 133 |
try:
|
| 134 |
-
#
|
|
|
|
| 135 |
try:
|
| 136 |
pipeline = Pipeline.from_pretrained(
|
| 137 |
-
|
|
|
|
| 138 |
token=ACTIVE_HF_TOKEN
|
| 139 |
)
|
| 140 |
except TypeError:
|
| 141 |
-
# Fallback
|
| 142 |
pipeline = Pipeline.from_pretrained(
|
| 143 |
-
"
|
| 144 |
use_auth_token=ACTIVE_HF_TOKEN
|
| 145 |
)
|
| 146 |
|
|
@@ -179,6 +181,12 @@ if uploaded_file:
|
|
| 179 |
|
| 180 |
if "transcript" in st.session_state:
|
| 181 |
st.divider()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
brief = st.text_area("Creative Brief", placeholder="e.g. Focus on the yeast story, remove the interviewer.")
|
| 183 |
|
| 184 |
if st.button("Step 2: Create EDL"):
|
|
|
|
| 131 |
|
| 132 |
# 1. Diarization
|
| 133 |
try:
|
| 134 |
+
# Fixed for recent pyannote.audio: separate model and revision
|
| 135 |
+
model_id = "pyannote/speaker-diarization"
|
| 136 |
try:
|
| 137 |
pipeline = Pipeline.from_pretrained(
|
| 138 |
+
model_id,
|
| 139 |
+
revision="2.1",
|
| 140 |
token=ACTIVE_HF_TOKEN
|
| 141 |
)
|
| 142 |
except TypeError:
|
| 143 |
+
# Fallback if 'revision' isn't supported in old versions
|
| 144 |
pipeline = Pipeline.from_pretrained(
|
| 145 |
+
f"{model_id}@2.1",
|
| 146 |
use_auth_token=ACTIVE_HF_TOKEN
|
| 147 |
)
|
| 148 |
|
|
|
|
| 181 |
|
| 182 |
if "transcript" in st.session_state:
|
| 183 |
st.divider()
|
| 184 |
+
|
| 185 |
+
# Diarization Preview to help the user identify roles
|
| 186 |
+
with st.expander("Transcript Preview (Diarized)"):
|
| 187 |
+
for seg in st.session_state.transcript[:20]: # Show first 20 segments
|
| 188 |
+
st.write(f"**{seg['speaker']}:** {seg['text']}")
|
| 189 |
+
|
| 190 |
brief = st.text_area("Creative Brief", placeholder="e.g. Focus on the yeast story, remove the interviewer.")
|
| 191 |
|
| 192 |
if st.button("Step 2: Create EDL"):
|