Hi,
I am trying to create question and answering system for uploaded file. I use side bar for uploading files, and calling one of my webserivice to store in the db. after that i created a text field for question entering followed by a ask button. but whenever we click ask button after file uploaded its again uploading the file. even I am calling two different webservices.
st.sidebar.header("upload files to perform actions")
file_object= st.sidebar.file_uploader('upload text files',type=['txt','pdf'])
if file_object is not None:
print(file_object.name)
print(file_object.type)
with st.spinner("Please wait while file uploading into server" ):
files = {"file": (file_object.name, file_object, "multipart/form-data")}
status=requests.post("http://127.0.0.1:8000/readfileandstore/",files=files).json()
logging.info("status code")
logging.info(status)
st.sidebar.info("successfully uploaded ")
question = st.text_input("Please provide your query:",)
runquery= st.button('Ask')
if runquery:
if question:
with st.spinner("Performing neural search on documents",):
headers={"accept": "application/json" ,"Content-Type": "application/json"}
data = {"question": f'"{question}"'}
results=requests.post(' http://127.0.0.1:8000/findanswer',headers=headers,
json=data).json()
logging.info(results
I came to know i need to use state. but cannot move forward. any help is highly appreictaed.