Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,10 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
import io
|
| 4 |
-
from PIL import Image
|
| 5 |
import os
|
| 6 |
-
from
|
| 7 |
-
load_dotenv()
|
| 8 |
|
| 9 |
-
#
|
| 10 |
API_URL = "https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-dev"
|
| 11 |
headers = {"Authorization": f"Bearer {os.getenv('HF_API_TOKEN')}"}
|
| 12 |
|
|
@@ -24,8 +22,8 @@ def generate_image(input_text):
|
|
| 24 |
# Create Gradio interface
|
| 25 |
iface = gr.Interface(
|
| 26 |
fn=generate_image,
|
| 27 |
-
inputs=gr.
|
| 28 |
-
outputs=gr.
|
| 29 |
title="Image Generation with FLUX",
|
| 30 |
description="Enter a description to generate an image."
|
| 31 |
)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
import io
|
|
|
|
| 4 |
import os
|
| 5 |
+
from PIL import Image
|
|
|
|
| 6 |
|
| 7 |
+
# Get the API URL and headers from environment variables
|
| 8 |
API_URL = "https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-dev"
|
| 9 |
headers = {"Authorization": f"Bearer {os.getenv('HF_API_TOKEN')}"}
|
| 10 |
|
|
|
|
| 22 |
# Create Gradio interface
|
| 23 |
iface = gr.Interface(
|
| 24 |
fn=generate_image,
|
| 25 |
+
inputs=gr.Textbox(label="Input Text", placeholder="Enter your description here..."),
|
| 26 |
+
outputs=gr.Image(label="Generated Image"),
|
| 27 |
title="Image Generation with FLUX",
|
| 28 |
description="Enter a description to generate an image."
|
| 29 |
)
|