Bavisetti commited on
Commit
ff424f5
·
verified ·
1 Parent(s): 226cb05

creating app.py filr

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from diffusers import StableDiffusionPipeline
3
+ import torch
4
+
5
+ # Load the model (Make sure to set up the correct model path)
6
+ pipe = StableDiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16)
7
+ pipe = pipe.to("cuda")
8
+
9
+ # Define the function to process the uploaded image
10
+ def generate_headshot(image):
11
+ # Process the uploaded image and generate a professional headshot
12
+ generated_image = pipe(image).images[0]
13
+ return generated_image
14
+
15
+ # Create the Gradio interface
16
+ iface = gr.Interface(fn=generate_headshot, inputs=gr.Image(), outputs=gr.Image(), title="Professional Headshot Generator")
17
+
18
+ # Launch the interface
19
+ iface.launch()