nlpblogs commited on
Commit
b554c68
·
verified ·
1 Parent(s): 9348312

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -168,10 +168,17 @@ if st.button("Results"):
168
  labels = ["person", "location", "country", "city", "organization", "time", "date", "product", "event name", "money", "affiliation", "ordinal value", "percent value", "position"]
169
  entities = model.predict_entities(text, labels)
170
  df = pd.DataFrame(entities)
171
- st.dataframe(df)
172
  properties = {"border": "2px solid gray", "color": "blue", "font-size": "16px"}
173
  df_styled = df.style.set_properties(**properties)
174
  st.dataframe(df_styled)
 
 
 
 
 
 
 
175
 
176
 
177
 
 
168
  labels = ["person", "location", "country", "city", "organization", "time", "date", "product", "event name", "money", "affiliation", "ordinal value", "percent value", "position"]
169
  entities = model.predict_entities(text, labels)
170
  df = pd.DataFrame(entities)
171
+
172
  properties = {"border": "2px solid gray", "color": "blue", "font-size": "16px"}
173
  df_styled = df.style.set_properties(**properties)
174
  st.dataframe(df_styled)
175
+ if df is not None:
176
+ df["all"] = "all"
177
+ fig = px.treemap(df, path=['all', 'text', 'label'])
178
+ fig.update_traces(root_color="yellow")
179
+ fig.update_layout(margin = dict(t=50, l=25, r = 25, b=250))
180
+ st.plotly_chart(fig)
181
+
182
 
183
 
184