Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
return output
|
| 9 |
+
|
| 10 |
+
with gr.Blocks(theme=gr.themes.Citrus()) as demo:
|
| 11 |
+
with gr.Row():
|
| 12 |
+
with gr.Column():
|
| 13 |
+
prompt=gr.Textbox(label='your prompt', scale=1)
|
| 14 |
+
describe_btn=gr.Button("Generate Image", scale=1)
|
| 15 |
+
with gr.Column():
|
| 16 |
+
image=gr.Image(type='pil', label='your image')
|
| 17 |
+
describe_btn.click(fn=imageGen, inputs=prompt, outputs=image)
|
| 18 |
+
|
| 19 |
+
demo.launch(debug=True)
|