import os import huggingface_hub as hf_hub import gradio as gr client = hf_hub.InferenceClient(token = os.environ['HF_TOKEN']) 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, 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()