File size: 585 Bytes
edbe29c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
from main import extract_entities_from_file

def process(file):
    results = extract_entities_from_file(file)
    if not results:
        return "No entities found."
    return "\n".join([f"{text} -> {label}" for text, label in results])

iface = gr.Interface(
    fn=process,
    inputs=gr.File(label="Upload a text file"),
    outputs=gr.Textbox(label="Extracted Entities"),
    title="GLiNER + SpaCy Entity Extractor",
    description="Upload a text file to extract PERSON, ORG, LOCATION, and DISEASE entities."
)

if __name__ == "__main__":
    iface.launch()