Spaces:
Build error
Build error
File size: 972 Bytes
b3361ae |
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 |
import gradio as gr
from PIL import Image
import torch
from transformers import AutoModel, AutoProcessor
# Tải mô hình phân tích ảnh X-quang từ Google
model = AutoModel.from_pretrained("google/cxr-foundation")
processor = AutoProcessor.from_pretrained("google/cxr-foundation")
def du_doan_anh(image):
# Tiền xử lý ảnh
inputs = processor(images=image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
return "✅ AI đã phân tích ảnh.\n(Đây là mô hình biểu diễn đặc trưng, bạn có thể huấn luyện thêm.)"
# Tạo giao diện tiếng Việt
app = gr.Interface(
fn=du_doan_anh,
inputs=gr.Image(type="pil", label="📤 Chọn ảnh X-quang"),
outputs=gr.Textbox(label="🤖 Kết quả phân tích"),
title="Phân tích ảnh X-quang bằng AI",
description="Website thử nghiệm phân tích ảnh X-quang bằng mô hình AI huấn luyện sẵn."
)
app.launch() |