ben-epstein commited on
Commit
11710d1
1 Parent(s): 593a7a9

catch bad spans, propogate error message to UI

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -41,7 +41,10 @@ if spacy_data or st.button("Or try an example"):
41
  if run_data:
42
  st.write("Spacy input data:")
43
  st.json(run_data)
44
- hf_data = spacy_to_hf(run_data, tok)
45
- df = Dataset.from_dict(hf_data).to_pandas()
46
- st.write("Output huggingface format:")
47
- st.dataframe(df)
 
 
 
 
41
  if run_data:
42
  st.write("Spacy input data:")
43
  st.json(run_data)
44
+ try:
45
+ hf_data = spacy_to_hf(run_data, tok)
46
+ df = Dataset.from_dict(hf_data).to_pandas()
47
+ st.write("Output huggingface format:")
48
+ st.dataframe(df)
49
+ except Exception as e:
50
+ st.error(f"Failed to create tokens and tags: {str(e)}")