Fix multipart ModuleNotFoundError by renaming import to python_multipart (#10188)

* Fix ModuleNotFoundError

* add changeset

* more changes

* formt

* add changeset

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
This commit is contained in:
Julien Kirch 2024-12-12 20:26:45 +01:00 committed by GitHub
parent 9cd291b7f1
commit 22fe4ce5a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 4 deletions

View File

@ -0,0 +1,5 @@
---
"gradio": patch
---
feat:Fix `multipart` ModuleNotFoundError by renaming import to `python_multipart`

View File

@ -31,9 +31,8 @@ import anyio
import fastapi
import gradio_client.utils as client_utils
import httpx
import multipart
from gradio_client.documentation import document
from multipart.multipart import parse_options_header
from python_multipart.multipart import MultipartParser, parse_options_header
from starlette.datastructures import FormData, Headers, MutableHeaders, UploadFile
from starlette.formparsers import MultiPartException, MultipartPart
from starlette.responses import PlainTextResponse, Response
@ -644,7 +643,7 @@ class GradioMultiPartParser:
}
# Create the parser.
parser = multipart.MultipartParser(boundary, callbacks) # type: ignore
parser = MultipartParser(boundary, callbacks) # type: ignore
try:
# Feed the parser with data from the request.
async for chunk in self.stream:

View File

@ -56,7 +56,7 @@ from gradio_client import utils as client_utils
from gradio_client.documentation import document
from gradio_client.utils import ServerMessage
from jinja2.exceptions import TemplateNotFound
from multipart.multipart import parse_options_header
from python_multipart.multipart import parse_options_header
from starlette.background import BackgroundTask
from starlette.datastructures import UploadFile as StarletteUploadFile
from starlette.responses import RedirectResponse