Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
# Turkish NER Demo for Various Models
|
2 |
|
3 |
-
from transformers import pipeline, AutoModelForTokenClassification, AutoTokenizer
|
4 |
import streamlit as st
|
5 |
import pandas as pd
|
6 |
import spacy
|
@@ -58,8 +58,12 @@ elif input_method == "Write or Paste New Text":
|
|
58 |
|
59 |
@st.cache(allow_output_mutation=True)
|
60 |
def setModel(model_checkpoint, aggregation):
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
|
|
63 |
return pipeline('ner', model=model, tokenizer=tokenizer, aggregation_strategy=aggregation)
|
64 |
|
65 |
@st.cache(allow_output_mutation=True)
|
|
|
1 |
# Turkish NER Demo for Various Models
|
2 |
|
3 |
+
from transformers import pipeline, AutoModelForTokenClassification, AutoTokenizer, DebertaV2Tokenizer, DebertaV2Model
|
4 |
import streamlit as st
|
5 |
import pandas as pd
|
6 |
import spacy
|
|
|
58 |
|
59 |
@st.cache(allow_output_mutation=True)
|
60 |
def setModel(model_checkpoint, aggregation):
|
61 |
+
if model_checkpoint == "akdeniz27/mDeBERTa-v3-base-turkish-ner":
|
62 |
+
model = DebertaV2Model.from_pretrained(model_checkpoint)
|
63 |
+
tokenizer = DebertaV2Tokenizer.from_pretrained(model_checkpoint)
|
64 |
+
else:
|
65 |
+
model = AutoModelForTokenClassification.from_pretrained(model_checkpoint)
|
66 |
+
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
|
67 |
return pipeline('ner', model=model, tokenizer=tokenizer, aggregation_strategy=aggregation)
|
68 |
|
69 |
@st.cache(allow_output_mutation=True)
|