abhika-m commited on
Commit
26f12e6
1 Parent(s): ec446aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -9,8 +9,6 @@ huggingface_hub.login(token=os.environ["HF_TOKEN"])
9
  # Fava prompt
10
  INPUT = "Read the following references:\n{evidence}\nPlease identify all the errors in the following text using the information in the references provided and suggest edits if necessary:\n[Text] {output}\n[Edited] "
11
 
12
- _article = f'<center><img src="https://huggingface.co/spaces/fava-uw/fava/resolve/main/images/fava.png" width=800px></center>'
13
-
14
  model = vllm.LLM(model="fava-uw/fava-model")
15
  def result(passage, reference):
16
  prompt = [INPUT.format_map({"evidence":reference, "output":passage})]
@@ -41,7 +39,10 @@ def result(passage, reference):
41
  return f'<div style="font-weight: normal;">{output}</div>'; #output;
42
 
43
  if __name__ == "__main__":
44
- # description="Enter some text and a reference for the text and FAVA will detect and edit any hallucinations present."
45
- custom_footer = """<div style="text-align: center; padding: 20px;"><img src="./images/fava.png" alt="Example Image"></div>"""
46
- demo = gradio.Interface(fn=result, inputs=["text", "text"], outputs="html", title="Fine-grained Hallucination Detection and Editing (FAVA)", description=custom_footer)
 
 
 
47
  demo.launch(share=True)
 
9
  # Fava prompt
10
  INPUT = "Read the following references:\n{evidence}\nPlease identify all the errors in the following text using the information in the references provided and suggest edits if necessary:\n[Text] {output}\n[Edited] "
11
 
 
 
12
  model = vllm.LLM(model="fava-uw/fava-model")
13
  def result(passage, reference):
14
  prompt = [INPUT.format_map({"evidence":reference, "output":passage})]
 
39
  return f'<div style="font-weight: normal;">{output}</div>'; #output;
40
 
41
  if __name__ == "__main__":
42
+ article = """<center><img src="/fava-uw/fava/images/fava.png" alt="Example Image"></center>"""
43
+ examples = [["Canada's oldest national park, Banff, was established in 1886. It recently won a Nature's Choice 2023 award for its beautiful mountainous terrain. It's the best national park ever.",
44
+ "Banff National Park is Canada's oldest national park, established in 1885 as Rocky Mountains Park. Located in Alberta's Rocky Mountains, 110–180 kilometres (68–112 mi) west of Calgary, Banff encompasses 6,641 square kilometres (2,564 sq mi) of mountainous terrain."]]
45
+ demo = gradio.Interface(fn=result, inputs=["text", "text"], outputs="html", title="Fine-grained Hallucination Detection and Editing (FAVA)",
46
+ description="Enter some text and a reference for the text and FAVA will detect and edit any hallucinations present.", article=article,
47
+ examples=examples, allow_flagging="manual", flagging_options=["wrong detection", "wrong editing", "both wrong", "other"], flagging_dir="flags")
48
  demo.launch(share=True)