sunilkumardash9 / Pdf-GPT

A Gradio app for chatting with PDFs
MIT License
49 stars 20 forks source link

"error" shows up on inputting api key #2

Open mohsin250999 opened 1 year ago

mohsin250999 commented 1 year ago

Hey sunil,

Do you know what the issue with this is now? I've been trying to figure it out since yesterday and dont know why it stopped working

sunilkumardash9 commented 1 year ago

Can you share the full error? I haven't updated anything in the code, shouldn't be showing an error.

mohsin250999 commented 1 year ago
image

it just throws this error.

To create a public link, set `share=True` in `launch()`.
This is here
Traceback (most recent call last):
  File "C:\Users\mohsin\anaconda3\lib\site-packages\gradio\routes.py", line 437, in run_predict
    output = await app.get_blocks().process_api(
  File "C:\Users\mohsin\anaconda3\lib\site-packages\gradio\blocks.py", line 1352, in process_api
    result = await self.call_function(
  File "C:\Users\mohsin\anaconda3\lib\site-packages\gradio\blocks.py", line 1093, in call_function
    prediction = await utils.async_iteration(iterator)
  File "C:\Users\mohsin\anaconda3\lib\site-packages\gradio\utils.py", line 341, in async_iteration
    return await iterator.__anext__()
  File "C:\Users\mohsin\anaconda3\lib\site-packages\gradio\utils.py", line 334, in __anext__
    return await anyio.to_thread.run_sync(
  File "C:\Users\mohsin\anaconda3\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\Users\mohsin\anaconda3\lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "C:\Users\mohsin\anaconda3\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "C:\Users\mohsin\anaconda3\lib\site-packages\gradio\utils.py", line 317, in run_sync_iterator_async
    return next(iterator)
  File "c:/Users/mohsin/Desktop/Ricoh/Intern project/test/app.py", line 86, in get_response
    chain = app(file)
  File "c:/Users/mohsin/Desktop/Ricoh/Intern project/test/app.py", line 47, in __call__
    self.build_chain(file)
  File "c:/Users/mohsin/Desktop/Ricoh/Intern project/test/app.py", line 70, in build_chain
    documents, file_name = self.process_file(file)
  File "c:/Users/mohsin/Desktop/Ricoh/Intern project/test/app.py", line 66, in process_file
    file_name = match.group(1)
AttributeError: 'NoneType' object has no attribute 'group'
sunilkumardash9 commented 1 year ago

Could you run it locally, and see if there is any problem? It wasn't meant to run on HF space where multiple people can access it. It needs a bit of refactoring for that. Feel free to fork and make changes.

mohsin250999 commented 1 year ago

Nope locally it was giving the same error, i built it from scratch using your websites blog (which was very helpful, thanks!) and after making a few changes it seems to work .

sunilkumardash9 commented 1 year ago

Yes, thanks for pointing that out. Missed a step.

AIOpen123 commented 1 year ago

what was the fix?

sunilkumardash9 commented 1 year ago

@AIOpen123 As far as I remember self.chain = self.build_chain(file) in call() was missed