File size: 746 Bytes
81ac59f
 
9d1b8e4
 
f8381c5
 
 
 
f6f44a7
f8381c5
f6f44a7
 
 
f8381c5
 
 
f6f44a7
 
 
f8381c5
 
f6f44a7
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from diffusers import StableDiffusionPipeline
import torch
import gradio as gr

# Load the model (assuming it uses the Stable Diffusion architecture)
model_id = "Shakker-Labs/AWPortrait-FL"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32)
pipe.to("cpu")  # Use "cuda" if you have a GPU

# Generate an image from a text prompt
def generate_image(prompt):
    image = pipe(prompt).images[0]
    return image
    
# Define the function to generate the image
def chatbot_image(prompt):
    image = generate_image(prompt)
    return image

# Create a Gradio interface
interface = gr.Interface(fn=chatbot_image, inputs="text", outputs="image", title="Text-to-Image Chatbot")

# Launch the interface
interface.launch()