Gradio File component doesn't display progress bar in some cases. Gradio is making 2 requests to it's backend, when gr.File upload is started - one POST to the /upload endpont and one GET to the /upload_progress endpoint.
So, POST/upload endpont calls track method of FileUploadProgress instance and populating self._statusesdict of FileUploadProgress instance with upload_id of the file, and GET/upload_progress endpont basically returns stream of events of file with upload_id (uploading progress of this file).
OK.
But:
If GET to /upload_progress is executed FIRST (before the POST to the /upload), then this GET request will fail with FileUploadProgressNotTrackedError error, because there is no such upload_id in self._statusesdict of FileUploadProgress instance yet. And in this case, there will be no progress bar of uploading the file on frontend.
Have you searched existing issues? 🔎
[X] I have searched and found no existing issues
Reproduction
This bug is reproduced sometimes, but sometimes there is no bug, it depends on the order of execution of GET and POST requests mentioned above. So, just try to ulpload different files several times:
import gradio as gr
with gr.Blocks() as demo:
file_input = gr.File(
label="test",
)
demo.launch()
Describe the bug
Gradio
File
component doesn't display progress bar in some cases. Gradio is making 2 requests to it's backend, whengr.File
upload is started - onePOST
to the/upload
endpont and oneGET
to the/upload_progress
endpoint.So,
POST
/upload
endpont callstrack
method ofFileUploadProgress
instance and populatingself._statuses
dict
ofFileUploadProgress
instance withupload_id
of the file, andGET
/upload_progress
endpont basically returns stream of events of file withupload_id
(uploading progress of this file).OK.
But:
If
GET
to/upload_progress
is executed FIRST (before thePOST
to the/upload
), then thisGET
request will fail withFileUploadProgressNotTrackedError
error, because there is no suchupload_id
inself._statuses
dict
ofFileUploadProgress
instance yet. And in this case, there will be no progress bar of uploading the file on frontend.Have you searched existing issues? 🔎
Reproduction
This bug is reproduced sometimes, but sometimes there is no bug, it depends on the order of execution of
GET
andPOST
requests mentioned above. So, just try to ulpload different files several times:Screenshot
No response
Logs
No response
System Info
windows 11
Severity
I can't work with gradio
File
component properly.