File size: 711 Bytes
78f1051 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import gradio as gr
from app import depth_map_global # Import ảnh Depth Map từ FastAPI
def get_depth_map():
"""Trả về ảnh Depth Map mới nhất để hiển thị trên Gradio"""
if depth_map_global is None:
return "Chưa có ảnh Depth Map nào được xử lý!"
return depth_map_global
# 🟢 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, # Cập nhật theo thời gian thực
).launch(share=True) # `share=True` để tạo link truy cập từ bên ngoài
|