mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-15 14:51:19 -08:00
Code review changes
This commit is contained in:
parent
2799bf728c
commit
e4afa12fb9
3 changed files with 7 additions and 14 deletions
|
|
@ -116,10 +116,11 @@ class Phi_4(AsyncGeneratorProvider, ProviderModelMixin):
|
|||
|
||||
if images is not None:
|
||||
data = FormData()
|
||||
mimi_types = [None for i in range(len(images))]
|
||||
mime_types = [None for i in range(len(images))]
|
||||
for i in range(len(images)):
|
||||
mimi_types[i] = is_data_an_wav(images[i][0], images[i][1])
|
||||
mime_types[i] = is_data_an_wav(images[i][0], images[i][1])
|
||||
images[i] = (to_bytes(images[i][0]), images[i][1])
|
||||
mime_types[i] = is_accepted_format(images[i][0]) if mime_types[i] is None else mime_types[i]
|
||||
for image, image_name in images:
|
||||
data.add_field(f"files", to_bytes(image), filename=image_name)
|
||||
async with session.post(f"{cls.api_url}/gradio_api/upload", params={"upload_id": session_hash}, data=data) as response:
|
||||
|
|
@ -130,7 +131,7 @@ class Phi_4(AsyncGeneratorProvider, ProviderModelMixin):
|
|||
"url": f"{cls.api_url}/gradio_api/file={image_file}",
|
||||
"orig_name": images[i][1],
|
||||
"size": len(images[i][0]),
|
||||
"mime_type": mimi_types[i] or is_accepted_format(images[i][0]),
|
||||
"mime_type": mime_types[i],
|
||||
"meta": {
|
||||
"_type": "gradio.FileData"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,13 +96,5 @@ class HuggingSpace(AsyncGeneratorProvider, ProviderModelMixin):
|
|||
if not is_started and error is not None:
|
||||
raise error
|
||||
|
||||
BlackForestLabsFlux1Dev.parent = HuggingSpace.__name__,
|
||||
BlackForestLabsFlux1Schnell.parent = HuggingSpace.__name__,
|
||||
VoodoohopFlux1Schnell.parent = HuggingSpace.__name__,
|
||||
CohereForAI.parent = HuggingSpace.__name__,
|
||||
Janus_Pro_7B.parent = HuggingSpace.__name__,
|
||||
Phi_4.parent = HuggingSpace.__name__,
|
||||
Qwen_QVQ_72B.parent = HuggingSpace.__name__,
|
||||
Qwen_Qwen_2_5M_Demo.parent = HuggingSpace.__name__,
|
||||
Qwen_Qwen_2_72B_Instruct.parent = HuggingSpace.__name__,
|
||||
StableDiffusion35Large.parent = HuggingSpace.__name__,
|
||||
for provider in HuggingSpace.providers:
|
||||
provider.parent = HuggingSpace.__name__
|
||||
|
|
@ -217,7 +217,7 @@ class Api:
|
|||
elif isinstance(chunk, Reasoning):
|
||||
yield self._format_json("reasoning", **chunk.get_dict())
|
||||
elif isinstance(chunk, YouTube):
|
||||
yield self._format_json("content", chunk.to_string)
|
||||
yield self._format_json("content", chunk.to_string())
|
||||
elif isinstance(chunk, Audio):
|
||||
yield self._format_json("audio", str(chunk))
|
||||
elif isinstance(chunk, DebugResponse):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue