返回提交历史
Modified
g4f/Provider/PollinationsAI.py
+13
-4
Modified
g4f/Provider/PollinationsImage.py
+3
-13
XFEstudio/gpt4free
Update PollinationsImage provider
c4e4d340
代码差异
2 个文件
+16
-17
@@ -37,9 +37,18 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
37
37
38
38
# Models configuration
39
39
default_model = "openai"
40
default_image_model = "flux"
41
40
default_vision_model = "gpt-4o"
42
extra_image_models = ["midjourney", "dall-e-3", "flux-pro"]
41
extra_image_models = [
42
"flux",
43
"flux-pro",
44
"flux-realism",
45
"flux-anime",
46
"flux-3d",
47
"flux-cablyai",
48
"turbo",
49
"midjourney",
50
"dall-e-3",
51
]
43
52
vision_models = [default_vision_model, "gpt-4o-mini"]
44
53
reasoning_models = ['deepseek-reasoner', 'deepseek-r1']
45
54
extra_text_models = ["claude", "claude-email", "p1"] + vision_models + reasoning_models
@@ -77,7 +86,7 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
77
86
response = requests.get(url)
78
87
raise_for_status(response)
79
88
new_image_models = response.json()
80
cls.extra_image_models = list(dict.fromkeys([*cls.image_models, *cls.extra_image_models, *new_image_models]))
89
cls.extra_image_models = list(dict.fromkeys([*cls.extra_image_models, *new_image_models]))
81
90
82
91
url = "https://text.pollinations.ai/models"
83
92
response = requests.get(url)
@@ -123,7 +132,7 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
123
132
if not cache and seed is None:
124
133
seed = random.randint(0, 10000)
125
134
126
if model in cls.image_models and model not in cls.extra_image_models:
135
if model in cls.image_models or model in cls.extra_image_models:
127
136
async for chunk in cls._generate_image(
128
137
model=model,
129
138
prompt=format_image_prompt(messages, prompt),
@@ -7,25 +7,15 @@ from ..typing import AsyncResult, Messages
7
7
from .PollinationsAI import PollinationsAI
8
8
9
9
class PollinationsImage(PollinationsAI):
10
# From: https://pollinations.ai/static/js/components/FeedImage/ImageEditor.js
11
image_models = [
12
"flux",
13
"flux-pro",
14
"flux-realism",
15
"flux-anime",
16
"flux-3d",
17
"flux-cablyai",
18
"turbo",
19
]
20
10
default_model = "flux"
21
11
default_vision_model = None
22
12
default_image_model = default_model
23
13
24
14
@classmethod
25
15
def get_models(cls, **kwargs):
26
if not cls.models:
27
cls.models = list(dict.fromkeys([*cls.image_models, *cls.extra_image_models, *PollinationsAI.extra_image_models]))
28
return cls.models
16
if not cls.image_models:
17
cls.image_models = list(dict.fromkeys([*cls.image_models, *cls.extra_image_models]))
18
return cls.image_models
29
19
30
20
@classmethod
31
21
async def create_async_generator(