File size: 720 Bytes
f9fa22c
5946bd3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

import pandas as pd  # <-- CRITICAL MISSING IMPORT
import streamlit as st  # <-- CRITICAL MISSING IMPORT
from gliner import GLiNER

# 1. Initialize the GLiNER Model
model = GLiNER.from_pretrained("urchade/gliner_largev2")

# 2. Define Input Data
text = """
Cristiano Ronaldo dos Santos Aveiro
(Portuguese pronunciation: [kɾiʃˈtjɐnu ʁɔˈnaldu]; born 5 February 1985) is a Portuguese professional
footballer who plays as a forward for and captains both Saudi Pro League club
Al Nassr 
"""

labels = ["person", "award", "date", "competitions", "teams"]

# 3. Predict Entities
entities = model.predict_entities(text, labels)

# 4. Create and Display DataFrame in Streamlit
df = pd.DataFrame(entities)
st.dataframe(df)