Spaces:
Running
Running
anakin87
commited on
Commit
·
321ba78
1
Parent(s):
408dd7e
add sidebar
Browse files- Rock_fact_checker.py +4 -0
- app_utils/frontend_utils.py +6 -0
- data/statements.txt +2 -2
Rock_fact_checker.py
CHANGED
|
@@ -12,13 +12,17 @@ from app_utils.frontend_utils import (
|
|
| 12 |
entailment_html_messages,
|
| 13 |
create_df_for_relevant_snippets,
|
| 14 |
create_ternary_plot,
|
|
|
|
| 15 |
)
|
| 16 |
from app_utils.config import RETRIEVER_TOP_K
|
| 17 |
|
| 18 |
|
| 19 |
def main():
|
|
|
|
| 20 |
statements = load_statements()
|
| 21 |
|
|
|
|
|
|
|
| 22 |
# Persistent state
|
| 23 |
set_state_if_absent("statement", "Elvis Presley is alive")
|
| 24 |
set_state_if_absent("answer", "")
|
|
|
|
| 12 |
entailment_html_messages,
|
| 13 |
create_df_for_relevant_snippets,
|
| 14 |
create_ternary_plot,
|
| 15 |
+
build_sidebar
|
| 16 |
)
|
| 17 |
from app_utils.config import RETRIEVER_TOP_K
|
| 18 |
|
| 19 |
|
| 20 |
def main():
|
| 21 |
+
|
| 22 |
statements = load_statements()
|
| 23 |
|
| 24 |
+
build_sidebar()
|
| 25 |
+
|
| 26 |
# Persistent state
|
| 27 |
set_state_if_absent("statement", "Elvis Presley is alive")
|
| 28 |
set_state_if_absent("answer", "")
|
app_utils/frontend_utils.py
CHANGED
|
@@ -9,6 +9,12 @@ entailment_html_messages = {
|
|
| 9 |
"neutral": 'The knowledge base is <span style="color:darkgray">neutral</span> about your statement',
|
| 10 |
}
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
def set_state_if_absent(key, value):
|
| 14 |
if key not in st.session_state:
|
|
|
|
| 9 |
"neutral": 'The knowledge base is <span style="color:darkgray">neutral</span> about your statement',
|
| 10 |
}
|
| 11 |
|
| 12 |
+
def build_sidebar():
|
| 13 |
+
st.sidebar.markdown('# Fact checking 🎸 Rocks!')
|
| 14 |
+
st.sidebar.markdown('*Fact checking baseline combining dense retrieval and textual entailment*')
|
| 15 |
+
st.sidebar.markdown('[Github project](https://github.com/anakin87/fact-checking-rocks) - Based on [Haystack](https://github.com/deepset-ai/haystack)')
|
| 16 |
+
st.sidebar.markdown('<small>Data crawled from [Wikipedia](https://en.wikipedia.org/wiki/List_of_mainstream_rock_performers).</small>', unsafe_allow_html=True)
|
| 17 |
+
|
| 18 |
|
| 19 |
def set_state_if_absent(key, value):
|
| 20 |
if key not in st.session_state:
|
data/statements.txt
CHANGED
|
@@ -32,8 +32,8 @@ Chris Cornell took part in Soundgarden and Audioslave
|
|
| 32 |
Chris Cornell was a member of Pearl Jam
|
| 33 |
"There is a light that never goes out" is a song by The Smiths
|
| 34 |
Guns N' Roses formed in 1987
|
| 35 |
-
Izzy Stradlin took part in Guns N' Roses
|
| 36 |
-
Grunge was born in Seattle
|
| 37 |
Dave Grohl played in Nirvana and Foo Fighters
|
| 38 |
John Michael Stipe was part of the R.E.M.
|
| 39 |
Eric Clapton did some gigs with Dire Straits
|
|
|
|
| 32 |
Chris Cornell was a member of Pearl Jam
|
| 33 |
"There is a light that never goes out" is a song by The Smiths
|
| 34 |
Guns N' Roses formed in 1987
|
| 35 |
+
#Izzy Stradlin took part in Guns N' Roses
|
| 36 |
+
#Grunge was born in Seattle
|
| 37 |
Dave Grohl played in Nirvana and Foo Fighters
|
| 38 |
John Michael Stipe was part of the R.E.M.
|
| 39 |
Eric Clapton did some gigs with Dire Straits
|