Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from huggingface_hub import InferenceClient
|
| 3 |
+
|
| 4 |
+
def imageGen(prompt):
|
| 5 |
+
model_name="https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-dev"
|
| 6 |
+
client=InferenceClient(model=model_name)
|
| 7 |
+
output=client.text_to_image(prompt)
|
| 8 |
+
#saveData(prompt,output)
|
| 9 |
+
return output
|
| 10 |
+
|
| 11 |
+
with gr.Blocks(theme=gr.themes.Citrus()) as demo:
|
| 12 |
+
with gr.Row():
|
| 13 |
+
with gr.Column():
|
| 14 |
+
prompt = gr.Textbox(label="your prompt",scale=1)
|
| 15 |
+
describe_btn = gr.Button("Generate Image",scale=1)
|
| 16 |
+
with gr.Column():
|
| 17 |
+
image=gr.Image(type="pil", label="your image")
|
| 18 |
+
#sending the prompt to function to get an image
|
| 19 |
+
describe_btn.click(fn=imageGen, inputs= prompt, outputs=image)
|
| 20 |
+
demo.launch(debug=True)
|