Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

上传文件后不能返回结果 #21

Open
Yaolinwang opened this issue Nov 1, 2023 · 6 comments
Open

上传文件后不能返回结果 #21

Yaolinwang opened this issue Nov 1, 2023 · 6 comments

Comments

@Yaolinwang
Copy link

Yaolinwang commented Nov 1, 2023

  1. windows机器 (在不同机器上测试,结果一样)
  2. 模型:gpt-3.5-turbo-0613
  3. 多回合文字聊天没问题
  4. 上传文件之后聊天会卡主 - 没有报error(前端/后端)
  5. 检查了环境中包的版本和要求一致

local_interpreter

@MrGreyfun
Copy link
Owner

每次都是这样吗?感觉是网络问题

@Yaolinwang
Copy link
Author

hello 感谢快速回复。过了许久(大概20-30分钟左右),前端返回了这个错误:Backend error: There is no current event loop in thread 'AnyIO worker thread'.

local_interpreter 2

@Yaolinwang
Copy link
Author

更新:
尝试在另一台机器上使用(换成了官方api);响应速度快很多。上传文件后可以多轮对话。但是在上传文件后要求画图的时候又出现了相同的error:
image

@Yaolinwang
Copy link
Author

后端的error:

To create a public link, set share=True in launch().
C:\Users\xyz\anaconda3\envs\openaienv\lib\site-packages\zmq_future.py:679: RuntimeWarning: Proactor event loop does not implement add_reader family of methods required for zmq. Registering an additional selector thread for add_reader support via tornado. Use asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy()) to avoid this warning.
self._get_loop()
Traceback (most recent call last):
File "C:\Users\xyz\anaconda3\envs\openaienv\lib\site-packages\gradio\routes.py", line 442, in run_predict
output = await app.get_blocks().process_api(
File "C:\Users\xyz\anaconda3\envs\openaienv\lib\site-packages\gradio\blocks.py", line 1392, in process_api
result = await self.call_function(
File "C:\Users\xyz\anaconda3\envs\openaienv\lib\site-packages\gradio\blocks.py", line 1111, in call_function
prediction = await utils.async_iteration(iterator)
File "C:\Users\xyz\anaconda3\envs\openaienv\lib\site-packages\gradio\utils.py", line 346, in async_iteration
return await iterator.anext()
File "C:\Users\xyz\anaconda3\envs\openaienv\lib\site-packages\gradio\utils.py", line 339, in anext
return await anyio.to_thread.run_sync(
File "C:\Users\xyz\anaconda3\envs\openaienv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "C:\Users\xyz\anaconda3\envs\openaienv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "C:\Users\xyz\anaconda3\envs\openaienv\lib\asyncio\futures.py", line 284, in await
yield self # This tells Task to wait for completion.
File "C:\Users\xyz\anaconda3\envs\openaienv\lib\asyncio\tasks.py", line 328, in __wakeup
future.result()
File "C:\Users\xyz\anaconda3\envs\openaienv\lib\asyncio\futures.py", line 201, in result
raise self._exception
File "C:\Users\xyz\anaconda3\envs\openaienv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run
result = context.run(func, *args)
File "C:\Users\xyz\anaconda3\envs\openaienv\lib\site-packages\gradio\utils.py", line 322, in run_sync_iterator_async
return next(iterator)
File "C:\Users\xyz\anaconda3\envs\openaienv\lib\site-packages\gradio\utils.py", line 691, in gen_wrapper
yield from f(*args, **kwargs)
File "C:\Users\xyz\Desktop\local_interp\v1\src\web_ui.py", line 112, in bot
exit(-1)
File "C:\Users\xyz\anaconda3\envs\openaienv\lib_sitebuiltins.py", line 26, in call
raise SystemExit(code)
SystemExit: -1

@MrGreyfun
Copy link
Owner

要不试试把gradio更新到最新版本,这个包确实在不同平台之间不太稳定

@Yaolinwang
Copy link
Author

Yaolinwang commented Nov 3, 2023

请问下在什么平台上稳定些?

另外我升级之后无法上传文件了。显示了权限问题(没有打开该文件,不同windows机器尝试了几次):

To create a public link, set share=True in launch().
C:\Users\xyz.conda\envs\openaienv\lib\site-packages\zmq_future.py:679: RuntimeWarning: Proactor event loop does not implement add_reader family of methods required for zmq. Registering an additional selector thread for add_reader support via tornado. Use asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy()) to avoid this warning.
self._get_loop()
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "C:\Users\xyz.conda\envs\openaienv\lib\shutil.py", line 825, in move
os.rename(src, real_dst)
PermissionError: [WinError 32] 另一个程序正在使用此文件,进程无法访问。: 'C:\Users\xyz\AppData\Local\Temp\tmpvq5rqedo' -> 'C:\Users\xyz\AppData\Local\Temp\gradio\67cac232ecee98c18322886fd1855f909caa82b5\net_mv.csv'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 408, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call
return await self.app(scope, receive, send)
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\fastapi\applications.py", line 1106, in call
await super().call(scope, receive, send)
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\starlette\applications.py", line 122, in call
await self.middleware_stack(scope, receive, send)
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\starlette\middleware\errors.py", line 184, in call
raise exc
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\starlette\middleware\errors.py", line 162, in call
await self.app(scope, receive, _send)
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\starlette\middleware\cors.py", line 91, in call
await self.simple_response(scope, receive, send, request_headers=headers)
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\starlette\middleware\cors.py", line 146, in simple_response
await self.app(scope, receive, send)
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\starlette\middleware\exceptions.py", line 79, in call
raise exc
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\starlette\middleware\exceptions.py", line 68, in call
await self.app(scope, receive, sender)
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 20, in call
raise e
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 17, in call
await self.app(scope, receive, send)
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\starlette\routing.py", line 718, in call
await route.handle(scope, receive, send)
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\starlette\routing.py", line 276, in handle
await self.app(scope, receive, send)
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\starlette\routing.py", line 66, in app
response = await func(request)
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\fastapi\routing.py", line 274, in app
raw_response = await run_endpoint_function(
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\fastapi\routing.py", line 191, in run_endpoint_function
return await dependant.call(**values)
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\gradio\routes.py", line 706, in upload_file
await anyio.to_thread.run_sync(
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "C:\Users\xyz.conda\envs\openaienv\lib\asyncio\futures.py", line 284, in await
yield self # This tells Task to wait for completion.
File "C:\Users\xyz.conda\envs\openaienv\lib\asyncio\tasks.py", line 328, in __wakeup
future.result()
File "C:\Users\xyz.conda\envs\openaienv\lib\asyncio\futures.py", line 201, in result
raise self._exception
File "C:\Users\xyz.conda\envs\openaienv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run
result = context.run(func, *args)
File "C:\Users\xyz.conda\envs\openaienv\lib\shutil.py", line 846, in move
os.unlink(src)
PermissionError: [WinError 32] 另一个程序正在使用此文件,进程无法访问。: 'C:\Users\xyz\AppData\Local\Temp\tmpvq5rqedo'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants