File size: 2,174 Bytes
31ef714
 
 
5ff2701
ebfd33a
31ef714
 
 
 
 
 
 
 
 
edb9151
31ef714
 
 
4d0af7d
 
31ef714
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246eab5
 
 
 
60b5a84
 
 
 
 
2230e37
60b5a84
 
31ef714
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
import numpy as np
import random
import re
import torch
import config

with open("artist.txt", "r") as file:
    artists = file.readlines()

MAX_SEED = np.iinfo(np.int32).max

# 去除每行末尾的换行符
artists = [artist.strip() for artist in artists]

def feifeiprompt(randomize_seed,seed,prompt,quality_select,styles_Radio,FooocusExpansion_select):
    # 处理随机种子
    if randomize_seed:
        seed = random.randint(0, MAX_SEED)
    else:
        seed = int(seed)  # Ensure seed is an integer
    generator = torch.Generator().manual_seed(seed)

    if not prompt:
        prompt = "the photo is a 18 yo jpop girl is looking absolutely adorable and gorgeous, with a playful and mischievous grin, her eyes twinkling with joy. art by __artist__ and __artist__"
    if "__artist__" in prompt:
        # 随机选择艺术家
        selected_artists = random.sample(artists, len(artists))

        # 使用正则表达式替换所有的 __artist__
        def replace_artists(match):
            return selected_artists.pop(0)

        prompt = re.sub(r"__artist__", replace_artists, prompt)

    if quality_select:
        prompt += ", masterpiece, best quality, very aesthetic, absurdres"

    if FooocusExpansion_select:
        prompt = re.sub("girl", " feifei, A beautiful, 18 yo kpop idol, large-busted Japanese slim girl, with light makeup, gazing deeply into the camera, " ,prompt)
        prompt = re.sub("young woman", " feifei, A beautiful, 18 yo kpop idol, large-busted Japanese slim girl, with light makeup, gazing deeply into the camera, " ,prompt)
        prompt = re.sub("woman", " feifei, A beautiful, 18 yo kpop idol, large-busted Japanese slim girl, with light makeup, gazing deeply into the camera, " ,prompt)
        prompt = re.sub("model", " feifei, A beautiful, 18 yo kpop idol, large-busted Japanese slim girl, with light makeup, gazing deeply into the camera, " ,prompt)
    
    if styles_Radio:
        for style_name in styles_Radio:
            for style in config.style_list:
                if style["name"] == style_name:
                    prompt = style["prompt"].replace("{prompt}", prompt)


    return prompt,generator