Dannyar608 commited on
Commit
8f73aae
·
verified ·
1 Parent(s): e69e980

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -28
app.py CHANGED
@@ -1,37 +1,12 @@
1
- import gradio as gr
2
- from diffusers import StableDiffusionPipeline
3
- import torch
4
- import os
5
-
6
  token = os.getenv('token')
7
 
8
  from huggingface_hub import login
9
  login(token=token)
10
 
11
- gr.load("models/black-forest-labs/FLUX.1-dev").launch()
12
-
13
- # Load the model (you can replace this with the specific Kwai-Kolors/Kolors model if available)
14
- pipe = StableDiffusionPipeline.from_pretrained("Kwai-Kolors/Kolors")
15
- pipe.to("cuda" if torch.cuda.is_available() else "cpu")
16
-
17
- # Define function to generate image from text
18
- def generate_image(prompt):
19
- # Generate an image based on the provided text prompt
20
- image = pipe(prompt).images[0]
21
- return image
22
-
23
- # Create Gradio interface for chatbot
24
- interface = gr.Interface(
25
- fn=generate_image,
26
- inputs=gr.Textbox(label="Enter your prompt:"),
27
- outputs=gr.Image(type="pil"),
28
- live=True,
29
- title="Text-to-Image Generation",
30
- description="Enter a text prompt to generate a photorealistic image."
31
- )
32
 
33
- # Launch the interface
34
- interface.launch()
35
 
36
 
37
 
 
1
+ import os
 
 
 
 
2
  token = os.getenv('token')
3
 
4
  from huggingface_hub import login
5
  login(token=token)
6
 
7
+ import gradio as gr
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
+ gr.load("models/black-forest-labs/FLUX.1-dev").launch()
 
10
 
11
 
12