mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-15 14:51:19 -08:00
Add support image links in UI
This commit is contained in:
parent
e18297f358
commit
28810e4773
2 changed files with 6 additions and 2 deletions
|
|
@ -389,7 +389,7 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
|
|||
encoded_prompt = prompt
|
||||
if model == "gptimage" and aspect_ratio is not None:
|
||||
encoded_prompt = f"{encoded_prompt} aspect-ratio: {aspect_ratio}"
|
||||
encoded_prompt = quote_plus(encoded_prompt)[:2048-len(cls.image_api_endpoint)-len(query)-8]
|
||||
encoded_prompt = quote_plus(encoded_prompt)[:4096-len(cls.image_api_endpoint)-len(query)-8]
|
||||
url = f"{cls.image_api_endpoint}prompt/{encoded_prompt}?{query}"
|
||||
def get_url_with_seed(i: int, seed: Optional[int] = None):
|
||||
if model == "gptimage":
|
||||
|
|
|
|||
|
|
@ -107,13 +107,17 @@ class Backend_Api(Api):
|
|||
else:
|
||||
json_data = request.json
|
||||
tempfiles = []
|
||||
media = []
|
||||
if "files" in request.files:
|
||||
media = []
|
||||
for file in request.files.getlist('files'):
|
||||
if file.filename != '' and is_allowed_extension(file.filename):
|
||||
newfile = get_tempfile(file)
|
||||
tempfiles.append(newfile)
|
||||
media.append((Path(newfile), file.filename))
|
||||
if "media_url" in request.form:
|
||||
for url in request.form.getlist("media_url"):
|
||||
media.append((url, None))
|
||||
if media:
|
||||
json_data['media'] = media
|
||||
|
||||
if app.demo and not json_data.get("provider"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue