chandralegend commited on
Commit
42935e3
1 Parent(s): 31bcbcd

fixed color issue

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -92,6 +92,10 @@ def openai_chat_completion_response(final_prompt):
92
 
93
  return response["choices"][0]["message"]["content"].strip(" \n")
94
 
 
 
 
 
95
 
96
  my_sentence = st.text_input("Your Sentence")
97
  if st.button("Submit"):
@@ -101,7 +105,7 @@ if st.button("Submit"):
101
  ners_dictionary = ast.literal_eval(ners)
102
  for entity_type, entity_list in ners_dictionary.items():
103
  entity_list = list(set(entity_list))
104
- color = st.session_state["guidelines"][entity_type]["color"]
105
  for ent in entity_list:
106
  if ent != "None":
107
  my_sentence = re.sub(
 
92
 
93
  return response["choices"][0]["message"]["content"].strip(" \n")
94
 
95
+ colors = {}
96
+ for guideline in st.session_state["guidelines"]:
97
+ colors[guideline["entity"]] = guideline["color"]
98
+
99
 
100
  my_sentence = st.text_input("Your Sentence")
101
  if st.button("Submit"):
 
105
  ners_dictionary = ast.literal_eval(ners)
106
  for entity_type, entity_list in ners_dictionary.items():
107
  entity_list = list(set(entity_list))
108
+ color = colors[entity_type]
109
  for ent in entity_list:
110
  if ent != "None":
111
  my_sentence = re.sub(