chandralegend commited on
Commit
ba54a85
1 Parent(s): 9b8c962

fixed color issue

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -65,7 +65,6 @@ openai.api_key = os.getenv("OPENAI_API_KEY")
65
  SYSTEM_PROMPT = "You are a smart and intelligent Named Entity Recognition (NER) system. I will provide you the definition of the entities you need to extract, the sentence from where your extract the entities and the output format with examples."
66
  USER_PROMPT_1 = "Are you clear about your role?"
67
  ASSISTANT_PROMPT_1 = "Sure, I'm ready to help you with your NER task. Please provide me with the necessary information to get started."
68
- GUIDELINES_PROMPT = generate_guidelines_prompt(edited_df.to_dict(orient="index"))
69
 
70
 
71
  def openai_chat_completion_response(final_prompt):
@@ -82,15 +81,15 @@ def openai_chat_completion_response(final_prompt):
82
  return response["choices"][0]["message"]["content"].strip(" \n")
83
 
84
 
85
- colors = {}
86
- for guideline in edited_df.to_dict(orient="index").values():
87
- colors[guideline["entity"]] = guideline["color"]
88
-
89
-
90
  my_sentence = st.text_input("Your Sentence")
91
  if st.button("Submit"):
 
 
 
 
 
92
  GUIDELINES_PROMPT = GUIDELINES_PROMPT.format(my_sentence)
93
- print(GUIDELINES_PROMPT)
94
  ners = openai_chat_completion_response(GUIDELINES_PROMPT)
95
  ners_dictionary = ast.literal_eval(ners)
96
  for entity_type, entity_list in ners_dictionary.items():
 
65
  SYSTEM_PROMPT = "You are a smart and intelligent Named Entity Recognition (NER) system. I will provide you the definition of the entities you need to extract, the sentence from where your extract the entities and the output format with examples."
66
  USER_PROMPT_1 = "Are you clear about your role?"
67
  ASSISTANT_PROMPT_1 = "Sure, I'm ready to help you with your NER task. Please provide me with the necessary information to get started."
 
68
 
69
 
70
  def openai_chat_completion_response(final_prompt):
 
81
  return response["choices"][0]["message"]["content"].strip(" \n")
82
 
83
 
 
 
 
 
 
84
  my_sentence = st.text_input("Your Sentence")
85
  if st.button("Submit"):
86
+ colors = {}
87
+ for guideline in edited_df.to_dict(orient="index").values():
88
+ colors[guideline["entity"]] = guideline["color"]
89
+
90
+ GUIDELINES_PROMPT = generate_guidelines_prompt(edited_df.to_dict(orient="index"))
91
  GUIDELINES_PROMPT = GUIDELINES_PROMPT.format(my_sentence)
92
+
93
  ners = openai_chat_completion_response(GUIDELINES_PROMPT)
94
  ners_dictionary = ast.literal_eval(ners)
95
  for entity_type, entity_list in ners_dictionary.items():