DeepVen commited on
Commit
8acce47
·
1 Parent(s): eb89dbb

Update LLMInsights.py

Browse files
Files changed (1) hide show
  1. LLMInsights.py +9 -9
LLMInsights.py CHANGED
@@ -179,11 +179,11 @@ def rag_response(response):
179
 
180
  st.markdown('<h1 style="color:#100170;font-size:48px;text-align:center;">RAG Response</h1>', unsafe_allow_html=True)
181
  st.markdown('<h1 style="color:#100170;font-size:24px;">Question</h1>', unsafe_allow_html=True)
182
- st.text_area(label=None, value=response["query"], height=30)
183
  st.markdown('<h1 style="color:#100170;font-size:24px;">RAG Output</h1>', unsafe_allow_html=True)
184
- st.text_area(label=None, value=response["result"])
185
  # st.markdown('<h1 style="color:#100170;font-size:24px;">Augmented knowledge</h1>', unsafe_allow_html=True)
186
- # st.text_area(label=None, value=response["source_documents"])
187
 
188
  #st.button("Check Hallucination")
189
 
@@ -206,7 +206,7 @@ def hallu_eval(question: str, answer: str, context: str):
206
  )
207
  print("got hallu score")
208
  st.markdown('<h1 style="color:#100170;font-size:24px;">Hallucinated?</h1>', unsafe_allow_html=True)
209
- st.text_area(label=None, value=hallucination_score, height=30)
210
  #return {"hallucination_score": hallucination_score}
211
  #time.sleep(10)
212
 
@@ -221,7 +221,7 @@ def scoring_eval(question: str, answer: str, context: str):
221
  )
222
  print("got score")
223
  st.markdown('<h1 style="color:#100170;font-size:24px;">Completion Score</h1>', unsafe_allow_html=True)
224
- st.text_area(label=None, value=score, height=30)
225
  #return {"hallucination_score": hallucination_score}
226
  #time.sleep(10)
227
 
@@ -396,15 +396,15 @@ with tab1:
396
  else:
397
  score = "Evaluation is Turned OFF"
398
  st.markdown('<h1 style="color:#100170;font-size:24px;">Confidence Score</h1>', unsafe_allow_html=True)
399
- st.text_area(label=None, value=score, height=30)
400
  st.markdown('<h1 style="color:#100170;font-size:24px;">Hallucinated?</h1>', unsafe_allow_html=True)
401
- st.text_area(label=None, value=hallucination_score, height=30)
402
  st.markdown('<h1 style="color:#100170;font-size:24px;">context</h1>', unsafe_allow_html=True)
403
- st.text_area(label=None, value=context)
404
  metadata_list = [doc.metadata for doc in response["source_documents"]]
405
  formatted_metadata_list = []
406
  for i, metadata in enumerate(metadata_list, start=1):
407
- formatted_metadata = f"<h2 style='color:#3366ff; font-weight:bold;'>Metadata {i}:</h2><br>"
408
  source = metadata.get('source', '').replace('\n', '')
409
  title = metadata.get('title', '').replace('\n', '')
410
  description = metadata.get('description', '').replace('\n', '')
 
179
 
180
  st.markdown('<h1 style="color:#100170;font-size:48px;text-align:center;">RAG Response</h1>', unsafe_allow_html=True)
181
  st.markdown('<h1 style="color:#100170;font-size:24px;">Question</h1>', unsafe_allow_html=True)
182
+ st.text_area(label="", value=response["query"], height=30)
183
  st.markdown('<h1 style="color:#100170;font-size:24px;">RAG Output</h1>', unsafe_allow_html=True)
184
+ st.text_area(label="", value=response["result"])
185
  # st.markdown('<h1 style="color:#100170;font-size:24px;">Augmented knowledge</h1>', unsafe_allow_html=True)
186
+ # st.text_area(label="", value=response["source_documents"])
187
 
188
  #st.button("Check Hallucination")
189
 
 
206
  )
207
  print("got hallu score")
208
  st.markdown('<h1 style="color:#100170;font-size:24px;">Hallucinated?</h1>', unsafe_allow_html=True)
209
+ st.text_area(label=" ", value=hallucination_score, height=30)
210
  #return {"hallucination_score": hallucination_score}
211
  #time.sleep(10)
212
 
 
221
  )
222
  print("got score")
223
  st.markdown('<h1 style="color:#100170;font-size:24px;">Completion Score</h1>', unsafe_allow_html=True)
224
+ st.text_area(label=" ", value=score, height=30)
225
  #return {"hallucination_score": hallucination_score}
226
  #time.sleep(10)
227
 
 
396
  else:
397
  score = "Evaluation is Turned OFF"
398
  st.markdown('<h1 style="color:#100170;font-size:24px;">Confidence Score</h1>', unsafe_allow_html=True)
399
+ st.text_area(label=" ", value=score, height=30)
400
  st.markdown('<h1 style="color:#100170;font-size:24px;">Hallucinated?</h1>', unsafe_allow_html=True)
401
+ st.text_area(label=" ", value=hallucination_score, height=30)
402
  st.markdown('<h1 style="color:#100170;font-size:24px;">context</h1>', unsafe_allow_html=True)
403
+ st.text_area(label="", value=context)
404
  metadata_list = [doc.metadata for doc in response["source_documents"]]
405
  formatted_metadata_list = []
406
  for i, metadata in enumerate(metadata_list, start=1):
407
+ formatted_metadata = f"<h2 style='color:#3366ff; font-size:16px;'>Metadata {i}:</h2><br>"
408
  source = metadata.get('source', '').replace('\n', '')
409
  title = metadata.get('title', '').replace('\n', '')
410
  description = metadata.get('description', '').replace('\n', '')