shukdevdatta123 commited on
Commit
b3ba75f
Β·
verified Β·
1 Parent(s): 6aad194

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -156,22 +156,22 @@ def chatbot(input_text, image, audio, pdf_file, openai_api_key, reasoning_effort
156
  if new_pdf_content:
157
  # Generate MCQ quiz questions
158
  quiz_response = generate_mcq_quiz(new_pdf_content, int(num_quiz_questions), openai_api_key, model_choice)
159
- history.append((f"User: [Uploaded PDF for Quiz - {int(num_quiz_questions)} questions]", f"Assistant: {quiz_response}"))
160
  else:
161
- history.append(("User: [Attempted to generate quiz without PDF]", "Assistant: Please upload a PDF file to generate quiz questions."))
162
  else:
163
  # Regular chat mode - generate the response
164
  response = generate_response(input_text, image, new_pdf_content, openai_api_key, reasoning_effort, model_choice)
165
 
166
  # Append the response to the history
167
  if input_text:
168
- history.append((f"User: {input_text}", f"Assistant: {response}"))
169
  elif image is not None:
170
- history.append((f"User: [Uploaded image]", f"Assistant: {response}"))
171
  elif pdf_file is not None:
172
- history.append((f"User: [Uploaded PDF]", f"Assistant: {response}"))
173
  else:
174
- history.append((f"User: [No input provided]", f"Assistant: Please provide some input (text, image, or PDF) for me to respond to."))
175
 
176
  return "", None, None, None, new_pdf_content, history
177
 
 
156
  if new_pdf_content:
157
  # Generate MCQ quiz questions
158
  quiz_response = generate_mcq_quiz(new_pdf_content, int(num_quiz_questions), openai_api_key, model_choice)
159
+ history.append((f"πŸ‘€: [Uploaded PDF for Quiz - {int(num_quiz_questions)} questions]", f"πŸ€–: {quiz_response}"))
160
  else:
161
+ history.append(("πŸ‘€: [Attempted to generate quiz without PDF]", "πŸ€–: Please upload a PDF file to generate quiz questions."))
162
  else:
163
  # Regular chat mode - generate the response
164
  response = generate_response(input_text, image, new_pdf_content, openai_api_key, reasoning_effort, model_choice)
165
 
166
  # Append the response to the history
167
  if input_text:
168
+ history.append((f"πŸ‘€: {input_text}", f"πŸ€–: {response}"))
169
  elif image is not None:
170
+ history.append((f"πŸ‘€: [Uploaded image]", f"πŸ€–: {response}"))
171
  elif pdf_file is not None:
172
+ history.append((f"πŸ‘€: [Uploaded PDF]", f"πŸ€–: {response}"))
173
  else:
174
+ history.append((f"πŸ‘€: [No input provided]", f"πŸ€–: Please provide some input (text, image, or PDF) for me to respond to."))
175
 
176
  return "", None, None, None, new_pdf_content, history
177