Spaces:
Runtime error
Runtime error
oryx1729
commited on
Commit
•
70b2fc9
1
Parent(s):
acc5901
Initial commit
Browse files- app.py +49 -0
- requirements.txt +1 -0
app.py
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import sys
|
2 |
+
import logging
|
3 |
+
import streamlit as st
|
4 |
+
from multipage import MultiPage
|
5 |
+
from pages import ask, settings, info
|
6 |
+
|
7 |
+
|
8 |
+
logging.basicConfig(
|
9 |
+
level=logging.DEBUG,
|
10 |
+
format="%(levelname)s %(asctime)s %(name)s:%(message)s",
|
11 |
+
handlers=[logging.StreamHandler(sys.stdout)],
|
12 |
+
force=True,
|
13 |
+
)
|
14 |
+
|
15 |
+
|
16 |
+
def init_session_key_value(key, value):
|
17 |
+
if key not in st.session_state:
|
18 |
+
st.session_state[key] = value
|
19 |
+
|
20 |
+
|
21 |
+
lfqa_api = "HuggingFace" if "api_lfqa_selector" not in st.secrets else st.secrets["api_lfqa_selector"]
|
22 |
+
session_values = {"api_lfqa_selector": lfqa_api,
|
23 |
+
"tts": "Google",
|
24 |
+
"min_length": 64,
|
25 |
+
"max_length": 256,
|
26 |
+
"do_sample": False,
|
27 |
+
"early_stopping": True,
|
28 |
+
"num_beams": 8,
|
29 |
+
"temperature": 1.0,
|
30 |
+
"top_k": None,
|
31 |
+
"top_p": None,
|
32 |
+
"no_repeat_ngram_size": 3,
|
33 |
+
"num_return_sequences": 1}
|
34 |
+
|
35 |
+
for k, v in session_values.items():
|
36 |
+
init_session_key_value(k, v)
|
37 |
+
|
38 |
+
app = MultiPage()
|
39 |
+
st.set_page_config(
|
40 |
+
page_title="Wikipedia Assistant",
|
41 |
+
initial_sidebar_state="expanded",
|
42 |
+
)
|
43 |
+
# Add all your application here
|
44 |
+
app.add_page("Home", "house", ask.app)
|
45 |
+
app.add_page("Settings", "gear", settings.app)
|
46 |
+
app.add_page("Info", "info", info.app)
|
47 |
+
|
48 |
+
# The main app
|
49 |
+
app.run()
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
farm-haystack
|