render1 / src /streamlit_app.py
AIEcosystem's picture
Update src/streamlit_app.py
5946bd3 verified
raw
history blame contribute delete
720 Bytes
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)