Spaces:
Sleeping
Sleeping
Stefano Fiorucci
commited on
Commit
•
09534c2
1
Parent(s):
fb4073e
Update app.py
Browse files
app.py
CHANGED
@@ -64,8 +64,8 @@ def query(pipe, question):
|
|
64 |
return (pipe.run(question, params={"Retriever": {"top_k": 10}, "Reader": {"top_k": 5}}), None)
|
65 |
|
66 |
def main():
|
67 |
-
st.set_page_config(page_title='Who killed Laura Palmer?',
|
68 |
-
page_icon="https://static.wikia.nocookie.net/twinpeaks/images/4/4a/Site-favicon.ico/revision/latest?cb=20210710003705")
|
69 |
|
70 |
pipe=start_haystack()
|
71 |
# my_ip=subprocess.run(['curl', 'ifconfig.me'], stdout=subprocess.PIPE).stdout.decode('utf-8')
|
@@ -83,7 +83,7 @@ def main():
|
|
83 |
st.session_state.results = None
|
84 |
st.session_state.raw_json = None
|
85 |
|
86 |
-
|
87 |
# Title
|
88 |
st.write("# Who killed Laura Palmer?")
|
89 |
st.write("### The first Twin Peaks Question Answering system!")
|
@@ -94,6 +94,46 @@ Ask any question on Twin Peaks and see if the systsem can find the correct answe
|
|
94 |
*Note: do not use keywords, but full-fledged questions.*
|
95 |
""", unsafe_allow_html=True)
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
# Search bar
|
98 |
question = st.text_input("",
|
99 |
value=st.session_state.question,
|
|
|
64 |
return (pipe.run(question, params={"Retriever": {"top_k": 10}, "Reader": {"top_k": 5}}), None)
|
65 |
|
66 |
def main():
|
67 |
+
# st.set_page_config(page_title='Who killed Laura Palmer?',
|
68 |
+
# page_icon="https://static.wikia.nocookie.net/twinpeaks/images/4/4a/Site-favicon.ico/revision/latest?cb=20210710003705")
|
69 |
|
70 |
pipe=start_haystack()
|
71 |
# my_ip=subprocess.run(['curl', 'ifconfig.me'], stdout=subprocess.PIPE).stdout.decode('utf-8')
|
|
|
83 |
st.session_state.results = None
|
84 |
st.session_state.raw_json = None
|
85 |
|
86 |
+
|
87 |
# Title
|
88 |
st.write("# Who killed Laura Palmer?")
|
89 |
st.write("### The first Twin Peaks Question Answering system!")
|
|
|
94 |
*Note: do not use keywords, but full-fledged questions.*
|
95 |
""", unsafe_allow_html=True)
|
96 |
|
97 |
+
# Sidebar
|
98 |
+
st.sidebar.header("Who killed Laura Palmer?")
|
99 |
+
st.sidebar.image("https://upload.wikimedia.org/wikipedia/it/3/39/Twin-peaks-1990.jpg")
|
100 |
+
st.sidebar.markdown("#### Twin Peaks Question Answering system")
|
101 |
+
st.sidebar.markdown(f"""
|
102 |
+
<style>
|
103 |
+
a {{
|
104 |
+
text-decoration: none;
|
105 |
+
}}
|
106 |
+
.haystack-footer {{
|
107 |
+
text-align: center;
|
108 |
+
}}
|
109 |
+
.haystack-footer h4 {{
|
110 |
+
margin: 0.1rem;
|
111 |
+
padding:0;
|
112 |
+
}}
|
113 |
+
footer {{
|
114 |
+
opacity: 0;
|
115 |
+
}}
|
116 |
+
.haystack-footer img {{
|
117 |
+
display: block;
|
118 |
+
margin-left: auto;
|
119 |
+
margin-right: auto;
|
120 |
+
width: 85%;
|
121 |
+
}}
|
122 |
+
</style>
|
123 |
+
<div class="haystack-footer">
|
124 |
+
<p>Get it on <a href="https://github.com/deepset-ai/haystack/">GitHub</a> -
|
125 |
+
Built with <a href="https://github.com/deepset-ai/haystack/">Haystack</a><br/>
|
126 |
+
<small>Data crawled from <a href="https://twinpeaks.fandom.com/wiki/Twin_Peaks_Wiki">Twin Peaks Wiki</a>.</small>
|
127 |
+
</p>
|
128 |
+
<img src = 'https://static.wikia.nocookie.net/twinpeaks/images/e/ef/Laura_Palmer%2C_the_Queen_Of_Hearts.jpg'/>
|
129 |
+
<br/>
|
130 |
+
</div>
|
131 |
+
""", unsafe_allow_html=True)
|
132 |
+
|
133 |
+
# st.sidebar.image('https://static.wikia.nocookie.net/twinpeaks/images/e/ef/Laura_Palmer%2C_the_Queen_Of_Hearts.jpg', width=270) #use_column_width='always'
|
134 |
+
song_i = random.randint(1,11)
|
135 |
+
st.sidebar.audio(f'http://twinpeaks.narod.ru/Media/0{song_i}.mp3')
|
136 |
+
|
137 |
# Search bar
|
138 |
question = st.text_input("",
|
139 |
value=st.session_state.question,
|