mehmet0001 commited on
Commit
21bf2d0
·
verified ·
1 Parent(s): ab5ba09

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -17
app.py CHANGED
@@ -14,25 +14,26 @@ prompt_template = """Answer the question only according to the information provi
14
  ## Question :
15
  # {}"""
16
 
17
- try:
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
- 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"
 
 
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 :")