amirkhanbloch commited on
Commit
3e30a8b
·
verified ·
1 Parent(s): 278aa4b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
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 dotenv import load_dotenv
7
- load_dotenv()
8
 
9
- # Define the API URL and headers
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.inputs.Textbox(label="Input Text", placeholder="Enter your description here..."),
28
- outputs=gr.outputs.Image(type="pil", label="Generated Image"),
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
  )