nickmuchi commited on
Commit
a6212a8
·
1 Parent(s): 6d6f4ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -296,7 +296,10 @@ st.markdown("""
296
 
297
  st.markdown("---")
298
 
299
- url_text = st.text_input("Please Enter a url here",value="https://www.rba.gov.au/monetary-policy/rba-board-minutes/2022/2022-05-03.html",key='text')
 
 
 
300
 
301
  st.markdown(
302
  "<h3 style='text-align: center; color: red;'>OR</h3>",
@@ -305,9 +308,9 @@ st.markdown(
305
 
306
  upload_doc = st.file_uploader(
307
  "Upload a .txt, .pdf, .docx file"
308
- )
309
 
310
- search_query = st.text_input("Please Enter your search query here",value="What are the expectations for inflation for Australia?")
311
 
312
  if validators.url(url_text):
313
  #if input is URL
@@ -315,8 +318,7 @@ if validators.url(url_text):
315
  passages = preprocess_plain_text(text,window_size=window_size)
316
 
317
  elif upload_doc:
318
-
319
- st.session_state["text"] = ""
320
  text, pdf_title = extract_text_from_file(upload_doc)
321
  passages = preprocess_plain_text(text,window_size=window_size)
322
 
 
296
 
297
  st.markdown("---")
298
 
299
+ def clear_text():
300
+ st.session_state["text_url"] = ""
301
+ st.session_state["text_input"]= ""
302
+ url_text = st.text_input("Please Enter a url here",value="https://www.rba.gov.au/monetary-policy/rba-board-minutes/2022/2022-05-03.html",key='text_url')
303
 
304
  st.markdown(
305
  "<h3 style='text-align: center; color: red;'>OR</h3>",
 
308
 
309
  upload_doc = st.file_uploader(
310
  "Upload a .txt, .pdf, .docx file"
311
+ ,on_change=clear_text)
312
 
313
+ search_query = st.text_input("Please Enter your search query here",value="What are the expectations for inflation for Australia?",key="text_input")
314
 
315
  if validators.url(url_text):
316
  #if input is URL
 
318
  passages = preprocess_plain_text(text,window_size=window_size)
319
 
320
  elif upload_doc:
321
+
 
322
  text, pdf_title = extract_text_from_file(upload_doc)
323
  passages = preprocess_plain_text(text,window_size=window_size)
324