File size: 644 Bytes
b1959a5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import gradio as gr
from PIL import Image
def get_depth_map():
"""Trả về ảnh Depth Map mới nhất từ FastAPI"""
try:
return Image.open("depth_map.png") # 🟢 Lấy ảnh đã lưu từ FastAPI
except FileNotFoundError:
return "Chưa có ảnh Depth Map nào được xử lý!"
# 🟢 Tạo UI trên Hugging Face Spaces với Gradio
gr.Interface(
fn=get_depth_map,
inputs=[],
outputs=gr.Image(type="pil"),
title="🔍 Depth Map Viewer",
description="Hiển thị ảnh Depth Map mới nhất từ FastAPI",
live=True # 🎯 **Tự động cập nhật ảnh mới**
).launch()
|