File size: 549 Bytes
5667b16
 
 
 
 
 
 
 
d394f6d
5667b16
 
 
 
d394f6d
5667b16
 
 
d394f6d
5667b16
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# import gradio as gr

# def greet(name):
#     return "Hello " + name + "!!"

# demo = gr.Interface(fn=greet, inputs="text", outputs="text")
# demo.launch()

import gradio as gr
from transformers import pipeline

# Load model from Hugging Face Hub
classifier = pipeline("text-classification", model="Mhammad2023/bert-finetuned-ner")

def predict(text):
    result = classifier(text)[0]
    return f"{result['label']} ({round(result['score']*100, 2)}%)"

gr.Interface(fn=predict, inputs="text", outputs="text", title="Text Classification").launch()