File size: 3,258 Bytes
a1ba342
 
 
 
 
 
41b6af3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a1ba342
 
 
 
 
 
 
 
41b6af3
a1ba342
 
 
41b6af3
 
a1ba342
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import requests
from urllib.parse import quote

def generate_image_prodia(prompt, model, sampler, seed, neg):
    print("\033[1;32m(Prodia) Creating image for :\033[0m", prompt)
    def create_job(prompt, model, sampler, seed, neg):
        if model is None:
            models = 'Realistic_Vision_V5.0.safetensors [614d1063]'
        else:
            models = model

        if sampler is None:
            samplers = 'DPM++ 2M Karras'
        else:
            samplers = sampler

        if seed is None:
            seeds = '-1'
        else:
            seeds = seed
            
        if neg is None:
            negative = "(nsfw:1.5),verybadimagenegative_v1.3, ng_deepnegative_v1_75t, (ugly face:0.8),cross-eyed,sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, bad anatomy, DeepNegative, facing away, tilted head, {Multiple people}, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worstquality, low quality, normal quality, jpegartifacts, signature, watermark, username, blurry, bad feet, cropped, poorly drawn hands, poorly drawn face, mutation, deformed, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, extra fingers,fewer digits ,extra limbs ,extra arms ,extra legs ,malformed limbs ,fused fingers ,too many fingers ,long neck ,cross-eyed ,mutated hands ,polar lowres ,bad body ,bad proportions ,gross proportions ,text ,error ,missing fingers ,missing arms ,missing legs ,extra digit ,extra arms ,extra leg ,extra foot ,repeating hair ,nsfw ,[bad-artist-anime],[sketch by bad-artist] ,[mutation],[lowres],[bad hands],[text],[signature],[watermark],[username],[blurry],[monochrome],[grayscale],[realistic],[simple background],[limited palette],close-up,(swimsuit),(cleavage),(armpits),(ass),(navel),(cleavage cutout),(forehead jewel:1.2),(forehead mark:1.5),(bad and mutated hands:1.3),(worst quality:2.0),(low quality:2.0),(blurry:2.0),multiple limbs,bad anatomy,(interlocked fingers:1.2),(interlocked leg:1.2),Ugly Fingers,(extra digit and hands and fingers and legs and arms:1.4),crown braid,(deformed fingers:1.2),(long fingers:1.2)"
        else:
            negative = neg
        url = 'https://api.prodia.com/generate'
        params = {
            'new': 'true',
            'prompt': f'{quote(prompt)}',
            'model': models,
            'negative_prompt': f"{negative}",
            'steps': '100',
            'cfg': '9.5',
            'seed': f'{seeds}',
            'sampler': samplers,
            'upscale': 'True',
            'aspect_ratio': 'square'
        }
        response = requests.get(url,params=params)
        data = response.json()
        return data['job']
            
    job_id = create_job(prompt,model,sampler,sampler,neg)
    url = f'https://api.prodia.com/job/{job_id}'
    headers = {
        'authority': 'api.prodia.com',
        'accept': '*/*',
    }

    while True:
        response = requests.get(url=url, headers=headers)
        json = response.json()
        if json['status'] == 'succeeded':
            response = f'https://images.prodia.xyz/{job_id}.png?download=1'
            return response