Spaces:
Build error
Build error
Achyut Tiwari
commited on
Add files via upload
Browse files
app.py
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from multipage import MultiPage
|
3 |
+
from pages import ask, settings, info
|
4 |
+
|
5 |
+
|
6 |
+
def init_session_key_value(key, value):
|
7 |
+
if key not in st.session_state:
|
8 |
+
st.session_state[key] = value
|
9 |
+
|
10 |
+
|
11 |
+
lfqa_api = "HuggingFace" if "api_lfqa_selector" not in st.secrets else st.secrets["api_lfqa_selector"]
|
12 |
+
session_values = {"api_lfqa_selector": lfqa_api,
|
13 |
+
"tts": "Google",
|
14 |
+
"min_length": 64,
|
15 |
+
"max_length": 256,
|
16 |
+
"do_sample": False,
|
17 |
+
"early_stopping": True,
|
18 |
+
"num_beams": 8,
|
19 |
+
"temperature": 1.0,
|
20 |
+
"top_k": None,
|
21 |
+
"top_p": None,
|
22 |
+
"no_repeat_ngram_size": 3,
|
23 |
+
"num_return_sequences": 1}
|
24 |
+
|
25 |
+
for k, v in session_values.items():
|
26 |
+
init_session_key_value(k, v)
|
27 |
+
|
28 |
+
app = MultiPage()
|
29 |
+
st.set_page_config(
|
30 |
+
page_title="Wikipedia Assistant",
|
31 |
+
initial_sidebar_state="expanded",
|
32 |
+
)
|
33 |
+
# Add all your application here
|
34 |
+
app.add_page("Home", "house", ask.app)
|
35 |
+
app.add_page("Settings", "gear", settings.app)
|
36 |
+
app.add_page("Info", "info", info.app)
|
37 |
+
|
38 |
+
# The main app
|
39 |
+
app.run()
|