XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

Code review changes

e4afa12f
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

3 个文件 +7 -14
Modified g4f/Provider/hf_space/Phi_4.py +4 -3
@@ -116,10 +116,11 @@ class Phi_4(AsyncGeneratorProvider, ProviderModelMixin):
116 116
117 117 if images is not None:
118 118 data = FormData()
119 mimi_types = [None for i in range(len(images))]
119 mime_types = [None for i in range(len(images))]
120 120 for i in range(len(images)):
121 mimi_types[i] = is_data_an_wav(images[i][0], images[i][1])
121 mime_types[i] = is_data_an_wav(images[i][0], images[i][1])
122 122 images[i] = (to_bytes(images[i][0]), images[i][1])
123 mime_types[i] = is_accepted_format(images[i][0]) if mime_types[i] is None else mime_types[i]
123 124 for image, image_name in images:
124 125 data.add_field(f"files", to_bytes(image), filename=image_name)
125 126 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):
130 131 "url": f"{cls.api_url}/gradio_api/file={image_file}",
131 132 "orig_name": images[i][1],
132 133 "size": len(images[i][0]),
133 "mime_type": mimi_types[i] or is_accepted_format(images[i][0]),
134 "mime_type": mime_types[i],
134 135 "meta": {
135 136 "_type": "gradio.FileData"
136 137 }
Modified g4f/Provider/hf_space/__init__.py +2 -10
@@ -96,13 +96,5 @@ class HuggingSpace(AsyncGeneratorProvider, ProviderModelMixin):
96 96 if not is_started and error is not None:
97 97 raise error
98 98
99 BlackForestLabsFlux1Dev.parent = HuggingSpace.__name__,
100 BlackForestLabsFlux1Schnell.parent = HuggingSpace.__name__,
101 VoodoohopFlux1Schnell.parent = HuggingSpace.__name__,
102 CohereForAI.parent = HuggingSpace.__name__,
103 Janus_Pro_7B.parent = HuggingSpace.__name__,
104 Phi_4.parent = HuggingSpace.__name__,
105 Qwen_QVQ_72B.parent = HuggingSpace.__name__,
106 Qwen_Qwen_2_5M_Demo.parent = HuggingSpace.__name__,
107 Qwen_Qwen_2_72B_Instruct.parent = HuggingSpace.__name__,
108 StableDiffusion35Large.parent = HuggingSpace.__name__,
99 for provider in HuggingSpace.providers:
100 provider.parent = HuggingSpace.__name__
Modified g4f/gui/server/api.py +1 -1
@@ -217,7 +217,7 @@ class Api:
217 217 elif isinstance(chunk, Reasoning):
218 218 yield self._format_json("reasoning", **chunk.get_dict())
219 219 elif isinstance(chunk, YouTube):
220 yield self._format_json("content", chunk.to_string)
220 yield self._format_json("content", chunk.to_string())
221 221 elif isinstance(chunk, Audio):
222 222 yield self._format_json("audio", str(chunk))
223 223 elif isinstance(chunk, DebugResponse):