not-lain commited on
Commit
8eb3297
1 Parent(s): 712a316

changed hullicination integration method

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -279,9 +279,12 @@ def process_and_query(input_language=None,audio_input=None,image_input=None,text
279
 
280
  # Process the summary with OpenAI
281
  final_response = process_summary_with_openai(markdown_output)
 
 
 
282
 
283
  # Return the processed summary along with the full output
284
- return f"**Summary**: {final_response}\n\n**Full output**:\n{markdown_output}"
285
  except Exception as e:
286
  return str(e)
287
 
@@ -432,13 +435,13 @@ with gr.Blocks(theme='ParityError/Anime') as iface :
432
  ["구강 헤르페스의 적절한 치료법은 무엇입니까?"],
433
  ["Je, ni matibabu gani sahihi kwa herpes ya buccal?"],
434
  ],inputs=[text_input])
435
- with gr.Accordion("hallucination check",open=True):
436
- assertion = gr.Textbox(label="assertion")
437
- citation = gr.Textbox(label="citation text")
438
- hullucination_output = gr.Markdown(label="output text")
439
- hallucination_button = gr.Button("check hallucination")
440
- gr.Examples([["i am drunk","sarah is pregnant"]],inputs=[assertion,citation])
441
- hallucination_button.click(check_hallucination,inputs=[assertion,citation],outputs=hullucination_output)
442
 
443
 
444
 
 
279
 
280
  # Process the summary with OpenAI
281
  final_response = process_summary_with_openai(markdown_output)
282
+
283
+ # check hullucination
284
+ hullucination_score = check_hallucination(text_input,final_response)
285
 
286
  # Return the processed summary along with the full output
287
+ return f"**Summary**: {final_response}\n\n**Full output**:\n{markdown_output}\n\n**Hullucination Score**:\n{hullucination_score}"
288
  except Exception as e:
289
  return str(e)
290
 
 
435
  ["구강 헤르페스의 적절한 치료법은 무엇입니까?"],
436
  ["Je, ni matibabu gani sahihi kwa herpes ya buccal?"],
437
  ],inputs=[text_input])
438
+ # with gr.Accordion("hallucination check",open=True):
439
+ # assertion = gr.Textbox(label="assertion")
440
+ # citation = gr.Textbox(label="citation text")
441
+ # hullucination_output = gr.Markdown(label="output text")
442
+ # hallucination_button = gr.Button("check hallucination")
443
+ # gr.Examples([["i am drunk","sarah is pregnant"]],inputs=[assertion,citation])
444
+ # hallucination_button.click(check_hallucination,inputs=[assertion,citation],outputs=hullucination_output)
445
 
446
 
447