Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,21 +1,26 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
|
|
3 |
|
4 |
-
# Load the
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
11 |
|
12 |
# Set up the Gradio interface
|
13 |
interface = gr.Interface(
|
14 |
-
fn=
|
15 |
inputs=gr.Image(type="pil", label="Upload Image to Enhance"),
|
16 |
outputs=gr.Image(type="pil", label="Enhanced Image"),
|
17 |
-
title="Image Enhancement
|
18 |
-
description="
|
19 |
live=True
|
20 |
)
|
21 |
|
|
|
1 |
import gradio as gr
|
2 |
+
import torch
|
3 |
+
from diffusers import StableDiffusionPipeline
|
4 |
|
5 |
+
# Load the image enhancement model
|
6 |
+
model_id = "fotographerai/zenctrl_tools"
|
7 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
8 |
|
9 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16 if device == "cuda" else torch.float32)
|
10 |
+
pipe.to(device)
|
11 |
+
|
12 |
+
def enhance_image(image):
|
13 |
+
# Process the image using the AI model
|
14 |
+
result = pipe(image).images[0] # Get the first enhanced image
|
15 |
+
return result
|
16 |
|
17 |
# Set up the Gradio interface
|
18 |
interface = gr.Interface(
|
19 |
+
fn=enhance_image,
|
20 |
inputs=gr.Image(type="pil", label="Upload Image to Enhance"),
|
21 |
outputs=gr.Image(type="pil", label="Enhanced Image"),
|
22 |
+
title="AI Image Enhancement",
|
23 |
+
description="Enhance your images using FotographerAI's ZenCtrl tools with AI!",
|
24 |
live=True
|
25 |
)
|
26 |
|