mrhan1993 / Fooocus-API

FastAPI powered API for Fooocus
GNU General Public License v3.0
528 stars 142 forks source link

Cannot modify the style #162

Closed XavierBelleau closed 6 months ago

XavierBelleau commented 6 months ago

I think I looked every where in the doc for the text-to-image but I can't seem to change the style of my image. Perhaps the default style are dominant.

here is my code that I use for generation :

prompt1 = sys.argv[1] styles = sys.argv[2:]

def text_to_image(prompt,styles): host = "http://127.0.0.1:8888" endpoint = "/v1/generation/text-to-image" url = f"{host}{endpoint}"

# Define your parameters here
params = {
    "prompt": prompt,
    "style": styles, 
    "performance_selection": "Speed",
    "aspect_ratios_selection": "1024*1024",
    "image_number": 1,
    "sharpness": 2.0,
    "guidance_scale": 4.0,
    "base_model_name": "juggernautXL_version6Rundiffusion.safetensors",
    "async_process": False  # Set to True for asynchronous processing
}

result = text_to_image(prompt1, styles) print("Image generation result:", result) publish_image_result(result)

the prompt works well but every time the style is not applied. Even by trying to hardcode the style like styles = ['Mk Van Gogh','SAI Origami'] I couldnt get it working what I'm I doing wrong? I'm new to all of this

mrhan1993 commented 6 months ago

sorry, is my fault, key should be "style_selections". i will fix docs soon

XavierBelleau commented 6 months ago

Thanks now its working perfectly!