fbellame / pdf-to-quizz

Upload a PDF and generate a quizz

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError

tjthejuggler opened this issue · comments

All I did was run it and drag a .pdf into it. It ran for about a minute and then gave me this error:

ValueError: Could not parse output: Question 1: According to the document, what is the definition of artificial intelligence? CHOICE_A: A system that is self-conscious and sentient CHOICE_B: Any automation system that considers changes in its environment CHOICE_C: A system that can influence the physical world only CHOICE_D: A system that is attended by humans Réponse: B Question 2: What is the topic of the document? CHOICE_A: The history of artificial intelligence CHOICE_B: The ethics of artificial intelligence CHOICE_C: The future of artificial intelligence CHOICE_D: The benefits of artificial intelligence Réponse: B
Traceback:

File "/home/lunkwill/.local/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
exec(code, module.dict)
File "/home/lunkwill/projects/pdf-to-quizz/ui.py", line 59, in
st.session_state['questions'] = asyncio.run(pdf_to_quizz(uploaded_file.name))
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "/home/lunkwill/projects/pdf-to-quizz/pdf_to_quizz.py", line 25, in pdf_to_quizz
questions = await asyncio.gather(*tasks)
File "/home/lunkwill/projects/pdf-to-quizz/pdf_to_quizz.py", line 16, in process_page
return await generate_quizz(page.page_content)
File "/home/lunkwill/projects/pdf-to-quizz/quizz_generator.py", line 20, in generate_quizz
return await llm_call(qa_chain, [{"doc": content}])
File "/home/lunkwill/projects/pdf-to-quizz/quizz_generator.py", line 8, in llm_call
batch_examples = await asyncio.gather(qa_chain.aapply_and_parse(text))
File "/home/lunkwill/.local/lib/python3.10/site-packages/langchain/chains/llm.py", line 209, in aapply_and_parse
return self._parse_result(result)
File "/home/lunkwill/.local/lib/python3.10/site-packages/langchain/chains/llm.py", line 198, in _parse_result
return [
File "/home/lunkwill/.local/lib/python3.10/site-packages/langchain/chains/llm.py", line 199, in
self.prompt.output_parser.parse(res[self.output_key]) for res in result
File "/home/lunkwill/.local/lib/python3.10/site-packages/langchain/output_parsers/regex.py", line 28, in parse
raise ValueError(f"Could not parse output: {text}")