File size: 1,699 Bytes
22d9d60
 
 
 
e05c2cb
af30170
22d9d60
fa4be79
22d9d60
cfdc5a4
9ba4010
08d7807
48f488d
fa4be79
22d9d60
 
08d7807
22d9d60
5302e8f
 
a576793
61a7806
fa4be79
 
a576793
5302e8f
 
 
 
22d9d60
 
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
import os 
import huggingface_hub as hf_hub
import gradio as gr

client = hf_hub.InferenceClient(token = os.environ['HF_TOKEN'])
client.headers["x-use-cache"] = "0"

def image_interface(prompt, guidance_scale, steps):
    response = client.text_to_image(
        prompt = f'concept art of {prompt}, oil painting, a photorealistically detailed painting, indian vedic culture, fair skinned, fantasy art, a beautiful artwork illustration, inspired by Raja Ravi Varma, trending on cg society.',
        negative_prompt = f'duplicate, black and white, fake, unrealistic, dark skinned, beard, moustache, photograph, ugly, deformed, noisy, blurry, old, bad anatomy, bad hands, three hands, three legs, bad arms, missing legs, missing arms, poorly drawn face, bad face, fused face, cloned face, worst face, three crus, extra crus, fused crus, worst feet, three feet, fused feet, fused thigh, three thigh, fused thigh, extra thigh, worst thigh, missing fingers, extra fingers, ugly fingers, long fingers, horn, extra eyes, huge eyes, 2girl, amputation, disconnected limbs.',
        model = 'stabilityai/stable-diffusion-xl-base-1.0',
        guidance_scale = guidance_scale,
        num_inference_steps = steps
    )

    return response

app = gr.Interface(
    fn = image_interface, 
    inputs = [
        gr.Textbox(label = 'Prompt'),  
        gr.Slider(minimum = 1, maximum = 30, value = 7.5, step = 0.1, label = 'Guidance Scale', show_label = True),
        gr.Slider(minimum = 0, maximum = 100, value = 50, step = 10, label = 'Number of Inference Steps', show_label = True)
    ], 
    outputs = 'image', 
    title = 'Oil Painting Generation',
    description = 'Vinay Kumar Thakur'
)

app.launch()