vkthakur88's picture
Create app.py
8d93865
raw
history blame contribute delete
No virus
997 Bytes
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, negative_prompt, guidance_scale, steps):
response = client.text_to_image(
prompt = prompt,
negative_prompt = negative_prompt,
model = 'segmind/Segmind-Vega',
guidance_scale = guidance_scale,
num_inference_steps = steps,
)
return response
app = gr.Interface(
fn = image_interface,
inputs = [
gr.Textbox(label = 'Prompt'),
gr.Textbox(label = 'Negative Prompt'),
gr.Slider(minimum = 1, maximum = 30, value = 7, step = 0.5, label = 'Guidance Scale', show_label = True),
gr.Slider(minimum = 10, maximum = 100, value = 50, step = 10, label = 'Number of Inference Steps', show_label = True)
],
outputs = 'image',
title = 'Stable Diffusion XL',
description = 'Vinay Kumar Thakur'
)
app.launch()