164_example / app.py
DrElaheJ's picture
update
6701e12 verified
raw
history blame contribute delete
753 Bytes
import gradio as gr
from huggingface_hub import InferenceClient
def imageGen(prompt):
model_name="https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-dev"
client=InferenceClient(model=model_name)
output=client.text_to_image(prompt)
#saveData(prompt,output)
return output
with gr.Blocks(theme=gr.themes.Citrus()) as demo:
with gr.Row():
with gr.Column():
prompt = gr.Textbox(label="your prompt",scale=1)
describe_btn = gr.Button("Generate Image",scale=1)
with gr.Column():
image=gr.Image(type="pil", label="your image")
#sending the prompt to function to get an image
describe_btn.click(fn=imageGen, inputs= prompt, outputs=image)
demo.launch(debug=True, share=True)