abhika-m commited on
Commit
f1e0495
β€’
1 Parent(s): d3a4bc4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -5,6 +5,7 @@ import huggingface_hub
5
  import os
6
 
7
  huggingface_hub.login(token=os.environ["HF_TOKEN"])
 
8
 
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] "
@@ -44,5 +45,5 @@ if __name__ == "__main__":
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="Given a passage and a reference, FAVA will detect and edit any hallucinations present in the passage.", 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)
 
5
  import os
6
 
7
  huggingface_hub.login(token=os.environ["HF_TOKEN"])
8
+ hf_writer = gr.HuggingFaceDatasetSaver(os.environ["HF_WRITE_TOKEN"], "fava-flagged-demo")
9
 
10
  # Fava prompt
11
  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] "
 
45
  "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."]]
46
  demo = gradio.Interface(fn=result, inputs=["text", "text"], outputs="html", title="Fine-grained Hallucination Detection and Editing (FAVA)",
47
  description="Given a passage and a reference, FAVA will detect and edit any hallucinations present in the passage.", article=article,
48
+ examples=examples, allow_flagging="manual", flagging_options=["wrong detection", "wrong edit", "both wrong", "other"], flagging_callback=hf_writer)
49
  demo.launch(share=True)