Spaces:
Running
Running
Francisco Zanartu
commited on
Commit
•
7f1f7ae
1
Parent(s):
de2e059
new tabbed app with gp4, palm2 and mixtral
Browse files
app.py
CHANGED
@@ -9,5 +9,58 @@ from utils.core import HamburgerStyle
|
|
9 |
|
10 |
rebuttal = HamburgerStyle()
|
11 |
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
rebuttal = HamburgerStyle()
|
11 |
|
12 |
+
|
13 |
+
def textgen(text):
|
14 |
+
return "Hi there"
|
15 |
+
|
16 |
+
|
17 |
+
gpt4 = gr.Interface(
|
18 |
+
fn=textgen,
|
19 |
+
inputs=[
|
20 |
+
gr.Textbox(
|
21 |
+
label="input myth", lines=4, placeholder="climate change misinformation"
|
22 |
+
),
|
23 |
+
gr.Textbox(label="credentials", lines=1, placeholder="your OpenAi API key"),
|
24 |
+
],
|
25 |
+
outputs=gr.Textbox(
|
26 |
+
lines=4, placeholder="## Fact:\n## Myth:\n## Fallacy:\n## Fact:\n"
|
27 |
+
),
|
28 |
+
allow_flagging="never",
|
29 |
+
description="Single, comprehensive prompt which assigns GPT-4 the role of a climate change analyst as an expert persona to debunk misinformation",
|
30 |
+
)
|
31 |
+
palm = gr.Interface(
|
32 |
+
fn=textgen,
|
33 |
+
inputs=gr.Textbox(
|
34 |
+
label="input myth", lines=4, placeholder="climate change misinformation"
|
35 |
+
),
|
36 |
+
outputs=gr.Textbox(
|
37 |
+
lines=4, placeholder="## Fact:\n## Myth:\n## Fallacy:\n## Fact:\n"
|
38 |
+
),
|
39 |
+
allow_flagging="never",
|
40 |
+
description="Single prompt with dinamic context relevant to the input myth, uses Palm2 LLM to debunk misinformation",
|
41 |
+
)
|
42 |
+
mix = gr.Interface(
|
43 |
+
fn=rebuttal.rebuttal_generator,
|
44 |
+
inputs=gr.Textbox(
|
45 |
+
label="input myth", lines=4, placeholder="climate change misinformation"
|
46 |
+
),
|
47 |
+
outputs=gr.Textbox(
|
48 |
+
lines=4, placeholder="## Fact:\n## Myth:\n## Fallacy:\n## Fact:\n"
|
49 |
+
),
|
50 |
+
allow_flagging="never",
|
51 |
+
description="Four separate prompts, one per component of the output debunking, uses Mixtral LLM to debunk misinformation",
|
52 |
+
)
|
53 |
+
|
54 |
+
|
55 |
+
demo = gr.TabbedInterface(
|
56 |
+
[gpt4, palm, mix],
|
57 |
+
[
|
58 |
+
"Single prompt, no context",
|
59 |
+
"Single prompt, with context",
|
60 |
+
"Structured prompt, with context",
|
61 |
+
],
|
62 |
+
title="Generative Debunking of Climate Misinformation",
|
63 |
+
)
|
64 |
+
|
65 |
+
if __name__ == "__main__":
|
66 |
+
demo.queue().launch()
|