Spaces:
Running
Running
File size: 721 Bytes
9567606 1ea8e84 a8f0668 9567606 3fdadb5 a8f0668 1ea8e84 a8f0668 9567606 a8f0668 1ea8e84 3fdadb5 1ea8e84 3fdadb5 9567606 3fdadb5 a8f0668 3fdadb5 9567606 3fdadb5 |
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 |
import gradio as gr
from rembg import remove
import numpy as np
# Функция для удаления водяных знаков с изображения
def remove_watermark(input_image):
# Сохранение массива numpy в файл
input_image = input_image.astype(np.uint8)
input_image = np.squeeze(input_image)
with open("input.png", "wb") as f:
f.write(input_image)
# Загрузка изображения и удаление фона
output = remove("input.png")
return output.tobytes()
# Создание Gradio приложения
iface = gr.Interface(
fn=remove_watermark,
inputs=gr.Image(type="numpy"),
outputs=gr.Image(),
)
iface.launch() |