siyam2009 commited on
Commit
324e6fd
·
verified ·
1 Parent(s): 73f21d4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -6
app.py CHANGED
@@ -1,13 +1,29 @@
1
  import os
2
  from huggingface_hub import InferenceClient
 
3
 
 
4
  client = InferenceClient(
5
  provider="nebius",
6
- api_key=os.environ["HF_TOKEN"],
7
  )
8
 
9
- # output is a PIL.Image object
10
- image = client.text_to_image(
11
- "Astronaut riding a horse",
12
- model="black-forest-labs/FLUX.1-dev",
13
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import os
2
  from huggingface_hub import InferenceClient
3
+ import gradio as gr
4
 
5
+ # Hugging Face Inference Client
6
  client = InferenceClient(
7
  provider="nebius",
8
+ api_key=os.environ["HF_TOKEN"], # HF_TOKEN Secrets এ দেওয়া থাকবে
9
  )
10
 
11
+ # Function যা Prompt থেকে ছবি জেনারেট করবে
12
+ def generate_image(prompt):
13
+ image = client.text_to_image(
14
+ prompt,
15
+ model="black-forest-labs/FLUX.1-dev",
16
+ )
17
+ return image
18
+
19
+ # Gradio UI
20
+ demo = gr.Interface(
21
+ fn=generate_image,
22
+ inputs=gr.Textbox(label="Enter your prompt"),
23
+ outputs=gr.Image(type="pil", label="Generated Image"),
24
+ title="FLUX.1 Text-to-Image Generator",
25
+ description="Type a prompt and generate an image using FLUX.1 model."
26
+ )
27
+
28
+ # Launch the app
29
+ demo.launch()