Spaces:
Sleeping
Sleeping
budhadityac24
commited on
Commit
•
4474bd3
1
Parent(s):
cd7d470
Update app.py
Browse files
app.py
CHANGED
@@ -340,7 +340,7 @@ def airtable_write(json_template):
|
|
340 |
|
341 |
def main():
|
342 |
st.title("Qualitas Sales Data Collection Chatbot")
|
343 |
-
st.caption("Welcome to the Qualitas Bot. First upload a PDF document which should be customer correspondence, detailing some requirements.
|
344 |
|
345 |
# Initialize session state variables
|
346 |
init_session_state()
|
@@ -372,7 +372,9 @@ def init_session_state():
|
|
372 |
|
373 |
def process_document(uploaded_file):
|
374 |
# Simulate file processing (replace with actual logic)
|
|
|
375 |
st.session_state.text = extract_text_from_pdf(uploaded_file)
|
|
|
376 |
st.session_state.classification_result = classification_LLM(st.session_state.text)
|
377 |
json_path='observationsJSON.json'
|
378 |
with open(json_path, 'r') as file:
|
@@ -384,6 +386,7 @@ def process_document(uploaded_file):
|
|
384 |
bizobj_json_template = json.load(file)
|
385 |
final_bizobj_json = bizobjjsoncreate(bizobj_json_template, st.session_state.text)
|
386 |
st.session_state.bizobj = final_bizobj_json
|
|
|
387 |
questionobs = question_create(final_obs_json)
|
388 |
questionbizobj = question_create(final_bizobj_json)
|
389 |
while True:
|
@@ -398,7 +401,7 @@ def process_document(uploaded_file):
|
|
398 |
# Wait for 1 second before trying again
|
399 |
time.sleep(1)
|
400 |
continue
|
401 |
-
st.write(st.session_state.questions)
|
402 |
# Mark file as processed
|
403 |
st.session_state.file_processed = True
|
404 |
st.success("Document processed successfully.")
|
@@ -438,6 +441,7 @@ def show_question():
|
|
438 |
|
439 |
else:
|
440 |
# Display the answers after completing the questionnaire
|
|
|
441 |
answers = [message["content"] for message in st.session_state.messages if message["role"] == "user"]
|
442 |
# with st.chat_message("assistant"):
|
443 |
# st.subheader("Answers")
|
|
|
340 |
|
341 |
def main():
|
342 |
st.title("Qualitas Sales Data Collection Chatbot")
|
343 |
+
st.caption("Welcome to the Qualitas Bot. First upload a PDF document which should be customer correspondence, detailing some requirements. Also sometimes the Submit button for the questions is a bit sticky. So You might have to click it twice!")
|
344 |
|
345 |
# Initialize session state variables
|
346 |
init_session_state()
|
|
|
372 |
|
373 |
def process_document(uploaded_file):
|
374 |
# Simulate file processing (replace with actual logic)
|
375 |
+
st.write("Parsing Document ...")
|
376 |
st.session_state.text = extract_text_from_pdf(uploaded_file)
|
377 |
+
st.write("Running Classification Algorithm...")
|
378 |
st.session_state.classification_result = classification_LLM(st.session_state.text)
|
379 |
json_path='observationsJSON.json'
|
380 |
with open(json_path, 'r') as file:
|
|
|
386 |
bizobj_json_template = json.load(file)
|
387 |
final_bizobj_json = bizobjjsoncreate(bizobj_json_template, st.session_state.text)
|
388 |
st.session_state.bizobj = final_bizobj_json
|
389 |
+
st.write("Creating Questions...")
|
390 |
questionobs = question_create(final_obs_json)
|
391 |
questionbizobj = question_create(final_bizobj_json)
|
392 |
while True:
|
|
|
401 |
# Wait for 1 second before trying again
|
402 |
time.sleep(1)
|
403 |
continue
|
404 |
+
# st.write(st.session_state.questions)
|
405 |
# Mark file as processed
|
406 |
st.session_state.file_processed = True
|
407 |
st.success("Document processed successfully.")
|
|
|
441 |
|
442 |
else:
|
443 |
# Display the answers after completing the questionnaire
|
444 |
+
st.success("Questions Complete! Please wait for final summary!")
|
445 |
answers = [message["content"] for message in st.session_state.messages if message["role"] == "user"]
|
446 |
# with st.chat_message("assistant"):
|
447 |
# st.subheader("Answers")
|