akdeniz27 commited on
Commit
41ca91f
1 Parent(s): 99fb071

Modify application file

Browse files
Files changed (1) hide show
  1. app.py +6 -7
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
- if model_checkpoint != "akdeniz27/xlm-roberta-base-turkish-ner":
32
- st.sidebar.header("Select Aggregation Strategy Type")
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
- cols_to_keep = ['word','entity_group','score','start','end']
 
 
 
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")