Spaces:
Sleeping
Sleeping
manu
commited on
Commit
·
a8684d5
1
Parent(s):
8e5f8e7
first try for seagull!
Browse files- app.py +72 -4
- flagged/log.csv +2 -0
app.py
CHANGED
@@ -1,7 +1,75 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
def greet(name):
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import numpy as np
|
2 |
import gradio as gr
|
3 |
|
|
|
|
|
4 |
|
5 |
+
title = "The Seagull story"
|
6 |
+
description = """
|
7 |
+
Albert and Dave are at a pier. They go to a restaurant. Albert orders seagull. He takes a bite, then he kills himself.\n
|
8 |
+
This is the final part of a story. It does not make sense at first, but in the end you can be sure it will actually make sense.\n
|
9 |
+
|
10 |
+
You can ask boolean questions to which you will receive one of the following answers:\n
|
11 |
+
|
12 |
+
"Yes" if it is true\n
|
13 |
+
"No" if it is not true\n
|
14 |
+
"Doesn't matter" if what you're asking is not important to understand the whole story.\n\n
|
15 |
+
|
16 |
+
Example: Bob liked the restaurant\n
|
17 |
+
--Answer: Doesn't matter\n
|
18 |
+
Bob shot himself because he did not have money to pay\n
|
19 |
+
--Answer: No
|
20 |
+
"""
|
21 |
+
|
22 |
+
|
23 |
+
def generate_tone(index,question):
|
24 |
+
passages=[
|
25 |
+
|
26 |
+
"""
|
27 |
+
Albert Dave and lucy are friends. they are completely normal people. Albert and lucy are happily married. Albert and lucy are
|
28 |
+
loyal and really love each other, their love is true. Albert loves lucy. lucy loves Albert. Albert Dave and lucy are middle aged.
|
29 |
+
Albert is blind. Albert is not religious.
|
30 |
+
the story is set in the early 900's. the story is completely plausible and does not involve anything not realistic.
|
31 |
+
""".replace("\n",""),
|
32 |
+
|
33 |
+
"""
|
34 |
+
A kind sailor saved Albert and Dave from an island and brought them to a pier with his boat. Now, they are sad and shocked.
|
35 |
+
Albert does not know lucy is dead, Dave knows Lucy is dead. They go to a restaurant. Albert orders seagull meat.
|
36 |
+
The waiter brings Albert the seagull meat. Everything is ordinary. The seagull meat is perfectly fine and edible.
|
37 |
+
After Albert takes a bite, he realizes he had never eaten seagull meat before and because of that Albert kills himself.
|
38 |
+
Dave knew Albert would suicide, so he is not surpirsed. Other people at the restaurant were surprised.
|
39 |
+
Albert and Dave were exhausted. Albert and Dave had discussions. Albert wanted to go to the restaurant
|
40 |
+
in order to eat seagull, Albert had this plan when he was on the island and nothing that happened changed Albert's mind.
|
41 |
+
""".replace("\n",""),
|
42 |
+
|
43 |
+
"""
|
44 |
+
Albert Dave and lucy are having fun. they did not have any argument.
|
45 |
+
what happened was not upon them. there is a storm and the boat is wrecked. Albert, Dave, lucy cast away on an island.
|
46 |
+
""".replace("\n",""),
|
47 |
+
|
48 |
+
"""
|
49 |
+
lucy dies in the shipwreck. Albert and Dave manage to survive. they are alone on the island. there is no one else on the island.
|
50 |
+
there are not dangerous animals. Albert and Dave do not have to fight to survive. there is no one else on the island.
|
51 |
+
there is not much food.they resort to unconvential food sources. they did not have to fight. Dave finds lucy's corpse.
|
52 |
+
they manage to survive.Dave is compelled to eat lucy. Dave does not want to eat lucy. Dave eats lucy. Albert also eats lucy.
|
53 |
+
because Albert is blind, Albert does not know he is eating lucy. Dave knows he is eating lucy. Dave revolts while eating lucy.
|
54 |
+
Albert does not revolt while eating lucy. Dave tells Albert he is eating seagull. Albert thinks he is eating seagull.
|
55 |
+
Albert is suspicious. there is a sailor passing by. the sailor saves Albert and Dave and brings them to a pier.
|
56 |
+
the sailor is a good man. the sailor does not have ill intentions. Albert and Dave are grateful to the sailor.
|
57 |
+
Albert does not know lucy is dead. Dave knows lucy is dead.
|
58 |
+
""".replace("\n","")
|
59 |
+
|
60 |
+
]
|
61 |
+
return passages[index],question
|
62 |
+
|
63 |
+
passages=["General","Pier","Boat","Island"]
|
64 |
+
|
65 |
+
gr.Interface.load(
|
66 |
+
"huggingface/MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli",
|
67 |
+
generate_tone,
|
68 |
+
[
|
69 |
+
gr.Dropdown(passages, type="index", value="Pier"),
|
70 |
+
gr.Textbox(type="text", value="Albert is stewpid!!", label="enter your question"),
|
71 |
+
],
|
72 |
+
"text",
|
73 |
+
title=title,
|
74 |
+
description=description,
|
75 |
+
).launch()
|
flagged/log.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
name,output,flag,username,timestamp
|
2 |
+
howdy,Hello howdy!!,,,2023-08-18 23:07:05.486219
|