class_docstr: Vendored from starlette.MultipartParser.
  
  Thanks starlette!
  
  Made the following modifications
      - Use GradioUploadFile instead of UploadFile
      - Use NamedTemporaryFile instead of SpooledTemporaryFile
      - Compute hash of data as the request is streamed
class_docstr_tok: ["Vendored","from","starlette.MultipartParser",".","Thanks","starlette","!","Made","the","following","modifications","-","Use","GradioUploadFile","instead","of","UploadFile","-","Use","NamedTemporaryFile","instead","of","SpooledTemporaryFile","-","Compute","hash","of","data","as","the","request","is","streamed"]
code: def on_headers_finished(self) -> None:
      disposition, options = parse_options_header(
          self._current_part.content_disposition
      )
      try:
          self._current_part.field_name = _user_safe_decode(
              options[b"name"], self._charset
          )
      except KeyError as e:
          raise MultiPartException(
              'The Content-Disposition header field "name" must be '
              "provided."
          ) from e
      if b"filename" in options:
          self._current_files += 1
          if self._current_files > self.max_files:
              raise MultiPartException(
                  f"Too many files. Maximum number of files is {self.max_files}."
              )
          filename = _user_safe_decode(
              options[b"filename"], self._charset
          )
          tempfile = NamedTemporaryFile(delete=False)
          self._files_to_close_on_error.append(tempfile)
          self._current_part.file = GradioUploadFile(
              file=tempfile,  # type: ignore[arg-type]
              size=0,
              filename=filename,
              headers=Headers(raw=self._current_part.item_headers),
          )
      else:
          self._current_fields += 1
          if self._current_fields > self.max_fields:
              raise MultiPartException(
                  f"Too many fields. Maximum number of fields is {self.max_fields}."
              )
          self._current_part.file = None
  
imports: from __future__ import annotations
  import hashlib
  import json
  from collections import deque
  from dataclasses import dataclass
  from tempfile import NamedTemporaryFile, _TemporaryFileWrapper
  from typing import TYPE_CHECKING, AsyncGenerator, BinaryIO, List, Optional, Tuple, Union
  import fastapi
  import httpx
  import multipart
  from gradio_client.documentation import document, set_documentation_group
  from multipart.multipart import parse_options_header
  from starlette.datastructures import FormData, Headers, UploadFile
  from starlette.formparsers import MultiPartException, MultipartPart
  from gradio import utils
  from gradio.data_classes import PredictBody
  from gradio.exceptions import Error
  from gradio.helpers import EventData
  from gradio.state_holder import SessionState
label_desc: Use image node_id 8 for calling the GradioMultiPartParser obj's underlying member method code with example usage: obj.on_headers_finished() without return types