Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,20 @@
|
|
1 |
|
2 |
import gradio as gr
|
3 |
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
|
2 |
import gradio as gr
|
3 |
|
4 |
+
# Tải mô hình NER tiếng Nhật
|
5 |
+
model = gr.load("models/tsmatz/xlm-roberta-ner-japanese")
|
6 |
+
|
7 |
+
# Chuẩn bị dữ liệu
|
8 |
+
data = ["Nguyen van dan", "Tran thi mai"]
|
9 |
+
|
10 |
+
# Gọi dự đoán
|
11 |
+
predictions = model.predict(data)
|
12 |
+
|
13 |
+
# Xuất kết quả
|
14 |
+
for prediction in predictions:
|
15 |
+
for entity in prediction:
|
16 |
+
print(f"Text: {entity['text']}")
|
17 |
+
print(f"Label: {entity['label']}")
|
18 |
+
print(f"Start: {entity['start']}")
|
19 |
+
print(f"End: {entity['end']}")
|
20 |
+
print()
|