Spaces:
Runtime error
Runtime error
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +3 -2
src/streamlit_app.py
CHANGED
|
@@ -90,7 +90,7 @@ def load_ner_model():
|
|
| 90 |
return pipeline(
|
| 91 |
"token-classification",
|
| 92 |
model="ml6team/keyphrase-extraction-kbir-inspec",
|
| 93 |
-
aggregation_strategy="max"
|
| 94 |
)
|
| 95 |
except Exception as e:
|
| 96 |
st.error(f"Failed to load NER model: {e}")
|
|
@@ -138,11 +138,12 @@ if st.button("Results"):
|
|
| 138 |
# It just uses 'label'
|
| 139 |
data.append({
|
| 140 |
'word': entity['word'],
|
| 141 |
-
'label': entity['
|
| 142 |
'score': entity['score'],
|
| 143 |
'start': entity['start'],
|
| 144 |
'end': entity['end']
|
| 145 |
})
|
|
|
|
| 146 |
|
| 147 |
if not data:
|
| 148 |
st.warning("No keyphrases found in the text.")
|
|
|
|
| 90 |
return pipeline(
|
| 91 |
"token-classification",
|
| 92 |
model="ml6team/keyphrase-extraction-kbir-inspec",
|
| 93 |
+
aggregation_strategy="max", stride=128, ignore_labels=["O"]
|
| 94 |
)
|
| 95 |
except Exception as e:
|
| 96 |
st.error(f"Failed to load NER model: {e}")
|
|
|
|
| 138 |
# It just uses 'label'
|
| 139 |
data.append({
|
| 140 |
'word': entity['word'],
|
| 141 |
+
'label': entity['entity_group'], # This is the correct key
|
| 142 |
'score': entity['score'],
|
| 143 |
'start': entity['start'],
|
| 144 |
'end': entity['end']
|
| 145 |
})
|
| 146 |
+
|
| 147 |
|
| 148 |
if not data:
|
| 149 |
st.warning("No keyphrases found in the text.")
|