Spaces:
Build error
Build error
File size: 1,096 Bytes
b3361ae bbf7e34 b3361ae bbf7e34 b3361ae bbf7e34 b3361ae bbf7e34 b3361ae bbf7e34 b3361ae bbf7e34 |
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 AI của Google dùng cho ảnh X-quang
model = AutoModel.from_pretrained("google/cxr-foundation")
processor = AutoProcessor.from_pretrained("google/cxr-foundation")
# Hàm xử lý khi người dùng tải ảnh lên
def phan_tich_anh(image):
inputs = processor(images=image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
return "✅ AI đã xử lý ảnh thành công!\n🧠 Mô hình có thể được huấn luyện thêm với dữ liệu riêng của bạn."
# Giao diện tiếng Việt
giao_dien = gr.Interface(
fn=phan_tich_anh,
inputs=gr.Image(type="pil", label="📤 Chọn ảnh X-quang"),
outputs=gr.Textbox(label="📋 Kết quả phân tích từ AI"),
title="🧠 Ứng dụng AI phân tích ảnh X-quang",
description="Ứng dụng thử nghiệm AI phân tích ảnh X-quang.\nChức năng đang được hoàn thiện. Không thay thế cho chẩn đoán y tế."
)
giao_dien.launch() |