huggingface-hub 0.33.1__tar.gz → 0.33.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of huggingface-hub might be problematic. Click here for more details.

Files changed (157) hide show
  1. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/PKG-INFO +1 -1
  2. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/__init__.py +1 -1
  3. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_client.py +16 -16
  4. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_common.py +7 -2
  5. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_mcp/agent.py +3 -2
  6. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_mcp/cli.py +7 -14
  7. huggingface_hub-0.33.2/src/huggingface_hub/inference/_mcp/types.py +39 -0
  8. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub.egg-info/PKG-INFO +1 -1
  9. huggingface_hub-0.33.1/src/huggingface_hub/inference/_mcp/types.py +0 -65
  10. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/LICENSE +0 -0
  11. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/MANIFEST.in +0 -0
  12. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/README.md +0 -0
  13. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/pyproject.toml +0 -0
  14. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/setup.cfg +0 -0
  15. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/setup.py +0 -0
  16. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/_commit_api.py +0 -0
  17. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/_commit_scheduler.py +0 -0
  18. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/_inference_endpoints.py +0 -0
  19. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/_local_folder.py +0 -0
  20. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/_login.py +0 -0
  21. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/_oauth.py +0 -0
  22. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/_snapshot_download.py +0 -0
  23. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/_space_api.py +0 -0
  24. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/_tensorboard_logger.py +0 -0
  25. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/_upload_large_folder.py +0 -0
  26. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/_webhooks_payload.py +0 -0
  27. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/_webhooks_server.py +0 -0
  28. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/commands/__init__.py +0 -0
  29. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/commands/_cli_utils.py +0 -0
  30. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/commands/delete_cache.py +0 -0
  31. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/commands/download.py +0 -0
  32. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/commands/env.py +0 -0
  33. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/commands/huggingface_cli.py +0 -0
  34. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/commands/lfs.py +0 -0
  35. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/commands/repo.py +0 -0
  36. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/commands/repo_files.py +0 -0
  37. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/commands/scan_cache.py +0 -0
  38. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/commands/tag.py +0 -0
  39. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/commands/upload.py +0 -0
  40. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/commands/upload_large_folder.py +0 -0
  41. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/commands/user.py +0 -0
  42. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/commands/version.py +0 -0
  43. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/community.py +0 -0
  44. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/constants.py +0 -0
  45. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/dataclasses.py +0 -0
  46. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/errors.py +0 -0
  47. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/fastai_utils.py +0 -0
  48. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/file_download.py +0 -0
  49. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/hf_api.py +0 -0
  50. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/hf_file_system.py +0 -0
  51. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/hub_mixin.py +0 -0
  52. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/__init__.py +0 -0
  53. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/__init__.py +0 -0
  54. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/_async_client.py +0 -0
  55. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/__init__.py +0 -0
  56. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/audio_classification.py +0 -0
  57. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/audio_to_audio.py +0 -0
  58. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/automatic_speech_recognition.py +0 -0
  59. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/base.py +0 -0
  60. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/chat_completion.py +0 -0
  61. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/depth_estimation.py +0 -0
  62. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/document_question_answering.py +0 -0
  63. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/feature_extraction.py +0 -0
  64. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/fill_mask.py +0 -0
  65. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/image_classification.py +0 -0
  66. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/image_segmentation.py +0 -0
  67. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/image_to_image.py +0 -0
  68. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/image_to_text.py +0 -0
  69. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/object_detection.py +0 -0
  70. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/question_answering.py +0 -0
  71. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/sentence_similarity.py +0 -0
  72. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/summarization.py +0 -0
  73. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/table_question_answering.py +0 -0
  74. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/text2text_generation.py +0 -0
  75. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/text_classification.py +0 -0
  76. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/text_generation.py +0 -0
  77. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/text_to_audio.py +0 -0
  78. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/text_to_image.py +0 -0
  79. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/text_to_speech.py +0 -0
  80. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/text_to_video.py +0 -0
  81. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/token_classification.py +0 -0
  82. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/translation.py +0 -0
  83. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/video_classification.py +0 -0
  84. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/visual_question_answering.py +0 -0
  85. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/zero_shot_classification.py +0 -0
  86. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/zero_shot_image_classification.py +0 -0
  87. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_generated/types/zero_shot_object_detection.py +0 -0
  88. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_mcp/__init__.py +0 -0
  89. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_mcp/_cli_hacks.py +0 -0
  90. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_mcp/constants.py +0 -0
  91. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_mcp/mcp_client.py +0 -0
  92. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_mcp/utils.py +0 -0
  93. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_providers/__init__.py +0 -0
  94. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_providers/_common.py +0 -0
  95. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_providers/black_forest_labs.py +0 -0
  96. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_providers/cerebras.py +0 -0
  97. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_providers/cohere.py +0 -0
  98. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_providers/fal_ai.py +0 -0
  99. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_providers/featherless_ai.py +0 -0
  100. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_providers/fireworks_ai.py +0 -0
  101. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_providers/groq.py +0 -0
  102. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_providers/hf_inference.py +0 -0
  103. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_providers/hyperbolic.py +0 -0
  104. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_providers/nebius.py +0 -0
  105. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_providers/novita.py +0 -0
  106. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_providers/nscale.py +0 -0
  107. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_providers/openai.py +0 -0
  108. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_providers/replicate.py +0 -0
  109. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_providers/sambanova.py +0 -0
  110. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference/_providers/together.py +0 -0
  111. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/inference_api.py +0 -0
  112. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/keras_mixin.py +0 -0
  113. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/lfs.py +0 -0
  114. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/py.typed +0 -0
  115. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/repocard.py +0 -0
  116. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/repocard_data.py +0 -0
  117. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/repository.py +0 -0
  118. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/serialization/__init__.py +0 -0
  119. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/serialization/_base.py +0 -0
  120. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/serialization/_dduf.py +0 -0
  121. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/serialization/_tensorflow.py +0 -0
  122. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/serialization/_torch.py +0 -0
  123. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/templates/datasetcard_template.md +0 -0
  124. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/templates/modelcard_template.md +0 -0
  125. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/__init__.py +0 -0
  126. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_auth.py +0 -0
  127. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_cache_assets.py +0 -0
  128. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_cache_manager.py +0 -0
  129. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_chunk_utils.py +0 -0
  130. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_datetime.py +0 -0
  131. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_deprecation.py +0 -0
  132. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_experimental.py +0 -0
  133. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_fixes.py +0 -0
  134. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_git_credential.py +0 -0
  135. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_headers.py +0 -0
  136. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_hf_folder.py +0 -0
  137. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_http.py +0 -0
  138. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_lfs.py +0 -0
  139. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_pagination.py +0 -0
  140. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_paths.py +0 -0
  141. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_runtime.py +0 -0
  142. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_safetensors.py +0 -0
  143. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_subprocess.py +0 -0
  144. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_telemetry.py +0 -0
  145. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_typing.py +0 -0
  146. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_validators.py +0 -0
  147. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/_xet.py +0 -0
  148. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/endpoint_helpers.py +0 -0
  149. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/insecure_hashlib.py +0 -0
  150. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/logging.py +0 -0
  151. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/sha.py +0 -0
  152. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub/utils/tqdm.py +0 -0
  153. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub.egg-info/SOURCES.txt +0 -0
  154. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub.egg-info/dependency_links.txt +0 -0
  155. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub.egg-info/entry_points.txt +0 -0
  156. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub.egg-info/requires.txt +0 -0
  157. {huggingface_hub-0.33.1 → huggingface_hub-0.33.2}/src/huggingface_hub.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: huggingface_hub
3
- Version: 0.33.1
3
+ Version: 0.33.2
4
4
  Summary: Client library to download and publish models, datasets and other repos on the huggingface.co hub
5
5
  Home-page: https://github.com/huggingface/huggingface_hub
6
6
  Author: Hugging Face, Inc.
@@ -46,7 +46,7 @@ import sys
46
46
  from typing import TYPE_CHECKING
47
47
 
48
48
 
49
- __version__ = "0.33.1"
49
+ __version__ = "0.33.2"
50
50
 
51
51
  # Alphabetical order of definitions is ensured in tests
52
52
  # WARNING: any comment added in this dictionary definition will be lost when
@@ -947,8 +947,8 @@ class InferenceClient:
947
947
  Answer questions on document images.
948
948
 
949
949
  Args:
950
- image (`Union[str, Path, bytes, BinaryIO]`):
951
- The input image for the context. It can be raw bytes, an image file, or a URL to an online image.
950
+ image (`Union[str, Path, bytes, BinaryIO, PIL.Image.Image]`):
951
+ The input image for the context. It can be raw bytes, an image file, a URL to an online image, or a PIL Image.
952
952
  question (`str`):
953
953
  Question to be answered.
954
954
  model (`str`, *optional*):
@@ -1156,8 +1156,8 @@ class InferenceClient:
1156
1156
  Perform image classification on the given image using the specified model.
1157
1157
 
1158
1158
  Args:
1159
- image (`Union[str, Path, bytes, BinaryIO]`):
1160
- The image to classify. It can be raw bytes, an image file, or a URL to an online image.
1159
+ image (`Union[str, Path, bytes, BinaryIO, PIL.Image.Image]`):
1160
+ The image to classify. It can be raw bytes, an image file, a URL to an online image, or a PIL Image.
1161
1161
  model (`str`, *optional*):
1162
1162
  The model to use for image classification. Can be a model ID hosted on the Hugging Face Hub or a URL to a
1163
1163
  deployed Inference Endpoint. If not provided, the default recommended model for image classification will be used.
@@ -1214,8 +1214,8 @@ class InferenceClient:
1214
1214
  </Tip>
1215
1215
 
1216
1216
  Args:
1217
- image (`Union[str, Path, bytes, BinaryIO]`):
1218
- The image to segment. It can be raw bytes, an image file, or a URL to an online image.
1217
+ image (`Union[str, Path, bytes, BinaryIO, PIL.Image.Image]`):
1218
+ The image to segment. It can be raw bytes, an image file, a URL to an online image, or a PIL Image.
1219
1219
  model (`str`, *optional*):
1220
1220
  The model to use for image segmentation. Can be a model ID hosted on the Hugging Face Hub or a URL to a
1221
1221
  deployed Inference Endpoint. If not provided, the default recommended model for image segmentation will be used.
@@ -1286,8 +1286,8 @@ class InferenceClient:
1286
1286
  </Tip>
1287
1287
 
1288
1288
  Args:
1289
- image (`Union[str, Path, bytes, BinaryIO]`):
1290
- The input image for translation. It can be raw bytes, an image file, or a URL to an online image.
1289
+ image (`Union[str, Path, bytes, BinaryIO, PIL.Image.Image]`):
1290
+ The input image for translation. It can be raw bytes, an image file, a URL to an online image, or a PIL Image.
1291
1291
  prompt (`str`, *optional*):
1292
1292
  The text prompt to guide the image generation.
1293
1293
  negative_prompt (`str`, *optional*):
@@ -1348,8 +1348,8 @@ class InferenceClient:
1348
1348
  (OCR), Pix2Struct, etc). Please have a look to the model card to learn more about a model's specificities.
1349
1349
 
1350
1350
  Args:
1351
- image (`Union[str, Path, bytes, BinaryIO]`):
1352
- The input image to caption. It can be raw bytes, an image file, or a URL to an online image..
1351
+ image (`Union[str, Path, bytes, BinaryIO, PIL.Image.Image]`):
1352
+ The input image to caption. It can be raw bytes, an image file, a URL to an online image, or a PIL Image.
1353
1353
  model (`str`, *optional*):
1354
1354
  The model to use for inference. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed
1355
1355
  Inference Endpoint. This parameter overrides the model defined at the instance level. Defaults to None.
@@ -1399,8 +1399,8 @@ class InferenceClient:
1399
1399
  </Tip>
1400
1400
 
1401
1401
  Args:
1402
- image (`Union[str, Path, bytes, BinaryIO]`):
1403
- The image to detect objects on. It can be raw bytes, an image file, or a URL to an online image.
1402
+ image (`Union[str, Path, bytes, BinaryIO, PIL.Image.Image]`):
1403
+ The image to detect objects on. It can be raw bytes, an image file, a URL to an online image, or a PIL Image.
1404
1404
  model (`str`, *optional*):
1405
1405
  The model to use for object detection. Can be a model ID hosted on the Hugging Face Hub or a URL to a
1406
1406
  deployed Inference Endpoint. If not provided, the default recommended model for object detection (DETR) will be used.
@@ -2974,8 +2974,8 @@ class InferenceClient:
2974
2974
  Answering open-ended questions based on an image.
2975
2975
 
2976
2976
  Args:
2977
- image (`Union[str, Path, bytes, BinaryIO]`):
2978
- The input image for the context. It can be raw bytes, an image file, or a URL to an online image.
2977
+ image (`Union[str, Path, bytes, BinaryIO, PIL.Image.Image]`):
2978
+ The input image for the context. It can be raw bytes, an image file, a URL to an online image, or a PIL Image.
2979
2979
  question (`str`):
2980
2980
  Question to be answered.
2981
2981
  model (`str`, *optional*):
@@ -3141,8 +3141,8 @@ class InferenceClient:
3141
3141
  Provide input image and text labels to predict text labels for the image.
3142
3142
 
3143
3143
  Args:
3144
- image (`Union[str, Path, bytes, BinaryIO]`):
3145
- The input image to caption. It can be raw bytes, an image file, or a URL to an online image.
3144
+ image (`Union[str, Path, bytes, BinaryIO, PIL.Image.Image]`):
3145
+ The input image to caption. It can be raw bytes, an image file, a URL to an online image, or a PIL Image.
3146
3146
  candidate_labels (`List[str]`):
3147
3147
  The candidate labels for this image
3148
3148
  labels (`List[str]`, *optional*):
@@ -61,7 +61,7 @@ if TYPE_CHECKING:
61
61
  UrlT = str
62
62
  PathT = Union[str, Path]
63
63
  BinaryT = Union[bytes, BinaryIO]
64
- ContentT = Union[BinaryT, PathT, UrlT]
64
+ ContentT = Union[BinaryT, PathT, UrlT, "Image"]
65
65
 
66
66
  # Use to set a Accept: image/png header
67
67
  TASKS_EXPECTING_IMAGES = {"text-to-image", "image-to-image"}
@@ -164,7 +164,6 @@ def _open_as_binary(content: Optional[ContentT]) -> Generator[Optional[BinaryT],
164
164
 
165
165
  Do nothing if `content` is None,
166
166
 
167
- TODO: handle a PIL.Image as input
168
167
  TODO: handle base64 as input
169
168
  """
170
169
  # If content is a string => must be either a URL or a path
@@ -185,6 +184,12 @@ def _open_as_binary(content: Optional[ContentT]) -> Generator[Optional[BinaryT],
185
184
  logger.debug(f"Opening content from {content}")
186
185
  with content.open("rb") as f:
187
186
  yield f
187
+ elif hasattr(content, "save"): # PIL Image
188
+ logger.debug("Converting PIL Image to bytes")
189
+ buffer = io.BytesIO()
190
+ content.save(buffer, format="PNG")
191
+ buffer.seek(0)
192
+ yield buffer
188
193
  else:
189
194
  # Otherwise: already a file-like object or None
190
195
  yield content
@@ -7,6 +7,7 @@ from huggingface_hub import ChatCompletionInputMessage, ChatCompletionStreamOutp
7
7
 
8
8
  from .._providers import PROVIDER_OR_POLICY_T
9
9
  from .constants import DEFAULT_SYSTEM_PROMPT, EXIT_LOOP_TOOLS, MAX_NUM_TURNS
10
+ from .types import ServerConfig
10
11
 
11
12
 
12
13
  class Agent(MCPClient):
@@ -40,7 +41,7 @@ class Agent(MCPClient):
40
41
  self,
41
42
  *,
42
43
  model: Optional[str] = None,
43
- servers: Iterable[Dict],
44
+ servers: Iterable[ServerConfig],
44
45
  provider: Optional[PROVIDER_OR_POLICY_T] = None,
45
46
  base_url: Optional[str] = None,
46
47
  api_key: Optional[str] = None,
@@ -54,7 +55,7 @@ class Agent(MCPClient):
54
55
 
55
56
  async def load_tools(self) -> None:
56
57
  for cfg in self._servers_cfg:
57
- await self.add_mcp_server(cfg["type"], **cfg["config"])
58
+ await self.add_mcp_server(**cfg)
58
59
 
59
60
  async def run(
60
61
  self,
@@ -85,11 +85,7 @@ async def run_agent(
85
85
  input_vars = set()
86
86
  for server in servers:
87
87
  # Check stdio's "env" and http/sse's "headers" mappings
88
- env_or_headers = (
89
- server["config"].get("env", {})
90
- if server["type"] == "stdio"
91
- else server["config"].get("options", {}).get("requestInit", {}).get("headers", {})
92
- )
88
+ env_or_headers = server.get("env", {}) if server["type"] == "stdio" else server.get("headers", {})
93
89
  for key, value in env_or_headers.items():
94
90
  if env_special_value in value:
95
91
  input_vars.add(key)
@@ -99,8 +95,9 @@ async def run_agent(
99
95
  continue
100
96
 
101
97
  # Prompt user for input
98
+ env_variable_key = input_id.replace("-", "_").upper()
102
99
  print(
103
- f"[blue] • {input_id}[/blue]: {description}. (default: load from {', '.join(sorted(input_vars))}).",
100
+ f"[blue] • {input_id}[/blue]: {description}. (default: load from {env_variable_key}).",
104
101
  end=" ",
105
102
  )
106
103
  user_input = (await _async_prompt(exit_event=exit_event)).strip()
@@ -109,23 +106,19 @@ async def run_agent(
109
106
 
110
107
  # Inject user input (or env variable) into stdio's env or http/sse's headers
111
108
  for server in servers:
112
- env_or_headers = (
113
- server["config"].get("env", {})
114
- if server["type"] == "stdio"
115
- else server["config"].get("options", {}).get("requestInit", {}).get("headers", {})
116
- )
109
+ env_or_headers = server.get("env", {}) if server["type"] == "stdio" else server.get("headers", {})
117
110
  for key, value in env_or_headers.items():
118
111
  if env_special_value in value:
119
112
  if user_input:
120
113
  env_or_headers[key] = env_or_headers[key].replace(env_special_value, user_input)
121
114
  else:
122
- value_from_env = os.getenv(key, "")
115
+ value_from_env = os.getenv(env_variable_key, "")
123
116
  env_or_headers[key] = env_or_headers[key].replace(env_special_value, value_from_env)
124
117
  if value_from_env:
125
- print(f"[green]Value successfully loaded from '{key}'[/green]")
118
+ print(f"[green]Value successfully loaded from '{env_variable_key}'[/green]")
126
119
  else:
127
120
  print(
128
- f"[yellow]No value found for '{key}' in environment variables. Continuing.[/yellow]"
121
+ f"[yellow]No value found for '{env_variable_key}' in environment variables. Continuing.[/yellow]"
129
122
  )
130
123
 
131
124
  print()
@@ -0,0 +1,39 @@
1
+ from typing import Dict, List, Literal, TypedDict, Union
2
+
3
+
4
+ class InputConfig(TypedDict, total=False):
5
+ id: str
6
+ description: str
7
+ type: str
8
+ password: bool
9
+
10
+
11
+ class StdioServerConfig(TypedDict):
12
+ type: Literal["stdio"]
13
+ command: str
14
+ args: List[str]
15
+ env: Dict[str, str]
16
+ cwd: str
17
+
18
+
19
+ class HTTPServerConfig(TypedDict):
20
+ type: Literal["http"]
21
+ url: str
22
+ headers: Dict[str, str]
23
+
24
+
25
+ class SSEServerConfig(TypedDict):
26
+ type: Literal["sse"]
27
+ url: str
28
+ headers: Dict[str, str]
29
+
30
+
31
+ ServerConfig = Union[StdioServerConfig, HTTPServerConfig, SSEServerConfig]
32
+
33
+
34
+ # AgentConfig root object
35
+ class AgentConfig(TypedDict):
36
+ model: str
37
+ provider: str
38
+ inputs: List[InputConfig]
39
+ servers: List[ServerConfig]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: huggingface-hub
3
- Version: 0.33.1
3
+ Version: 0.33.2
4
4
  Summary: Client library to download and publish models, datasets and other repos on the huggingface.co hub
5
5
  Home-page: https://github.com/huggingface/huggingface_hub
6
6
  Author: Hugging Face, Inc.
@@ -1,65 +0,0 @@
1
- from typing import Dict, List, Literal, TypedDict, Union
2
-
3
-
4
- # Input config
5
- class InputConfig(TypedDict, total=False):
6
- id: str
7
- description: str
8
- type: str
9
- password: bool
10
-
11
-
12
- # stdio server config
13
- class StdioServerConfig(TypedDict, total=False):
14
- command: str
15
- args: List[str]
16
- env: Dict[str, str]
17
- cwd: str
18
-
19
-
20
- class StdioServer(TypedDict):
21
- type: Literal["stdio"]
22
- config: StdioServerConfig
23
-
24
-
25
- # http server config
26
- class HTTPRequestInit(TypedDict, total=False):
27
- headers: Dict[str, str]
28
-
29
-
30
- class HTTPServerOptions(TypedDict, total=False):
31
- requestInit: HTTPRequestInit
32
- sessionId: str
33
-
34
-
35
- class HTTPServerConfig(TypedDict, total=False):
36
- url: str
37
- options: HTTPServerOptions
38
-
39
-
40
- class HTTPServer(TypedDict):
41
- type: Literal["http"]
42
- config: HTTPServerConfig
43
-
44
-
45
- # sse server config
46
- class SSEServerOptions(TypedDict, total=False):
47
- requestInit: HTTPRequestInit
48
-
49
-
50
- class SSEServerConfig(TypedDict):
51
- url: str
52
- options: SSEServerOptions
53
-
54
-
55
- class SSEServer(TypedDict):
56
- type: Literal["sse"]
57
- config: SSEServerConfig
58
-
59
-
60
- # AgentConfig root object
61
- class AgentConfig(TypedDict):
62
- model: str
63
- provider: str
64
- inputs: List[InputConfig]
65
- servers: List[Union[StdioServer, HTTPServer, SSEServer]]