Update app.py
Browse files
app.py
CHANGED
@@ -9,18 +9,11 @@ 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 |
-
|
13 |
-
<center>
|
14 |
-
The bot was trained to answer questions based on Rick and Morty dialogues. Ask Rick anything!
|
15 |
-
<img src="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})]
|
22 |
-
print(prompt)
|
23 |
-
print("\n")
|
24 |
sampling_params = vllm.SamplingParams(
|
25 |
temperature=0,
|
26 |
top_p=1.0,
|
@@ -48,5 +41,5 @@ def result(passage, reference):
|
|
48 |
return f'<div style="font-weight: normal;">{output}</div>'; #output;
|
49 |
|
50 |
if __name__ == "__main__":
|
51 |
-
demo = gradio.Interface(fn=result,
|
52 |
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 = f'<center><img src="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})]
|
|
|
|
|
17 |
sampling_params = vllm.SamplingParams(
|
18 |
temperature=0,
|
19 |
top_p=1.0,
|
|
|
41 |
return f'<div style="font-weight: normal;">{output}</div>'; #output;
|
42 |
|
43 |
if __name__ == "__main__":
|
44 |
+
demo = gradio.Interface(fn=result, 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)
|
45 |
demo.launch(share=True)
|