Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,25 +14,26 @@ prompt_template = """Answer the question only according to the information provi
|
|
14 |
## Question :
|
15 |
# {}"""
|
16 |
|
17 |
-
|
18 |
-
if st.session_state.stage == "remove-crawl":
|
19 |
-
st.session_state.stage = "prompt-input"
|
20 |
-
except Exception:
|
21 |
st.session_state.stage = "crawl-input"
|
|
|
|
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
36 |
|
37 |
if st.session_state.stage == "prompt-input":
|
38 |
prompt = st.text_area("Ask the documentation a question :")
|
|
|
14 |
## Question :
|
15 |
# {}"""
|
16 |
|
17 |
+
if not "stage" in st.session_state:
|
|
|
|
|
|
|
18 |
st.session_state.stage = "crawl-input"
|
19 |
+
elif st.session_state.stage == "remove-crawl-input-widgets":
|
20 |
+
st.session_state.stage = "prompt-input"
|
21 |
|
22 |
+
while True:
|
23 |
+
if st.session_state.stage == "crawl-input":
|
24 |
+
config = st.text_area("Enter the start URL and the limit of crawling (in this format : URL,limit):")
|
25 |
+
config_btn = st.button("Start crawling!")
|
26 |
+
|
27 |
+
st.write("im here")
|
28 |
+
if not (st.session_state.stage == "remove-crawl") and config and config_btn:
|
29 |
+
start = config.split(",")[0]
|
30 |
+
limit = int(config.split(",")[1])
|
31 |
+
|
32 |
+
txt = crawl_the_site.crawl(start,limit)
|
33 |
+
st.session_state.collection = create_database.create_database(txt)
|
34 |
+
st.write("Crawling is done.")
|
35 |
+
st.session_state.stage = "remove-crawl-input-widgets"
|
36 |
+
break
|
37 |
|
38 |
if st.session_state.stage == "prompt-input":
|
39 |
prompt = st.text_area("Ask the documentation a question :")
|