Spaces:
Build error
Build error
File size: 684 Bytes
2246494 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# app.py
import gradio as gr
from stylization import Stylizer
import cv2
import numpy as np
stylizer = Stylizer()
def stylize_interface(image):
# Convert from PIL to OpenCV format
image = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR)
result = stylizer.apply_style_threaded(image)
# Convert back to PIL format
result_rgb = cv2.cvtColor(result, cv2.COLOR_BGR2RGB)
return result_rgb
iface = gr.Interface(
fn=stylize_interface,
inputs=gr.Image(type="pil"),
outputs=gr.Image(type="pil"),
title="Threaded Image Stylizer",
description="Applies stylization filter using OpenCV with threading."
)
if __name__ == "__main__":
iface.launch() |