Spaces:
Runtime error
Runtime error
Modify application file
Browse files
app.py
CHANGED
|
@@ -28,12 +28,8 @@ elif selection == "convbert-base-turkish-cased-ner":
|
|
| 28 |
elif selection == "xlm-roberta-base-turkish-ner":
|
| 29 |
model_checkpoint = "akdeniz27/xlm-roberta-base-turkish-ner"
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
aggregation = st.sidebar.radio("", ('first', 'simple', 'average', 'max', 'none'))
|
| 34 |
-
else:
|
| 35 |
-
aggregation = "none"
|
| 36 |
-
st.sidebar.write("Aggregation strategy is set as 'none' for xlm-roberta model")
|
| 37 |
|
| 38 |
st.header("Select Text Input Method")
|
| 39 |
input_method = st.radio("", ('Select among Examples', 'Write or Paste New Text'))
|
|
@@ -58,7 +54,10 @@ if Run_Button == True:
|
|
| 58 |
output = ner_pipeline(input_text)
|
| 59 |
|
| 60 |
df = pd.DataFrame.from_dict(output)
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
| 62 |
df_final = df[cols_to_keep]
|
| 63 |
|
| 64 |
st.header("Recognized Entities")
|
|
|
|
| 28 |
elif selection == "xlm-roberta-base-turkish-ner":
|
| 29 |
model_checkpoint = "akdeniz27/xlm-roberta-base-turkish-ner"
|
| 30 |
|
| 31 |
+
st.sidebar.header("Select Aggregation Strategy Type")
|
| 32 |
+
aggregation = st.sidebar.radio("", ('first', 'simple', 'average', 'max', 'none'))
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
st.header("Select Text Input Method")
|
| 35 |
input_method = st.radio("", ('Select among Examples', 'Write or Paste New Text'))
|
|
|
|
| 54 |
output = ner_pipeline(input_text)
|
| 55 |
|
| 56 |
df = pd.DataFrame.from_dict(output)
|
| 57 |
+
if aggregation != "none":
|
| 58 |
+
cols_to_keep = ['word','entity_group','score','start','end']
|
| 59 |
+
else:
|
| 60 |
+
cols_to_keep = ['word','entity','score','start','end']
|
| 61 |
df_final = df[cols_to_keep]
|
| 62 |
|
| 63 |
st.header("Recognized Entities")
|