Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,13 @@ 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 |
model = vllm.LLM(model="fava-uw/fava-model")
|
13 |
def result(passage, reference):
|
14 |
prompt = [INPUT.format_map({"evidence":reference, "output":passage})]
|
@@ -41,10 +48,5 @@ def result(passage, reference):
|
|
41 |
return f'<div style="font-weight: normal;">{output}</div>'; #output;
|
42 |
|
43 |
if __name__ == "__main__":
|
44 |
-
article = """
|
45 |
-
<center>
|
46 |
-
<img src="https://huggingface.co/spaces/fava-uw/fava/resolve/main/images/fava.png" alt="Example" style="width: 200px;">
|
47 |
-
</center>
|
48 |
-
"""
|
49 |
demo = gradio.Interface(fn=result, flagging_dir="flagged/", inputs=["text", "text"], outputs="html", title="Fine-grained Hallucination Detection and Editing (FAVA)", description="Enter some text and a reference for the text and FAVA will detect and edit any hallucinations present.", article=article)
|
50 |
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 |
+
article = """
|
13 |
+
<center>
|
14 |
+
The bot was trained to answer questions based on Rick and Morty dialogues. Ask Rick anything!
|
15 |
+
<img src="https://huggingface.co/spaces/fava-uw/fava/resolve/main/images/fava.png" width=800px>
|
16 |
+
</center>
|
17 |
+
"""
|
18 |
+
|
19 |
model = vllm.LLM(model="fava-uw/fava-model")
|
20 |
def result(passage, reference):
|
21 |
prompt = [INPUT.format_map({"evidence":reference, "output":passage})]
|
|
|
48 |
return f'<div style="font-weight: normal;">{output}</div>'; #output;
|
49 |
|
50 |
if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
|
51 |
demo = gradio.Interface(fn=result, flagging_dir="flagged/", inputs=["text", "text"], outputs="html", title="Fine-grained Hallucination Detection and Editing (FAVA)", description="Enter some text and a reference for the text and FAVA will detect and edit any hallucinations present.", article=article)
|
52 |
demo.launch(share=True)
|