File size: 753 Bytes
f93d8a3
 
 
 
 
 
6701e12
f93d8a3
6c6975d
f93d8a3
 
 
 
 
 
 
 
 
 
 
 
2ac224d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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)