|
import gradio as gr |
|
from transformers import pipeline |
|
|
|
|
|
model_name = "preetidav/salesforce-similarity-model" |
|
classifier = pipeline("text-classification", model=model_name) |
|
|
|
def classify_sentence(sentence): |
|
result = classifier(sentence)[0] |
|
return f"Label: {result['label']} (Confidence: {result['score']:.2f})" |
|
|
|
|
|
iface = gr.Interface( |
|
fn=classify_sentence, |
|
inputs=gr.Textbox(lines=2, placeholder="Enter a sentence..."), |
|
outputs="text", |
|
title="Sentence Acceptability Classifier", |
|
description="This model classifies whether a sentence is linguistically acceptable (LABEL_1) or not (LABEL_0).", |
|
) |
|
|
|
|
|
iface.launch() |
|
|