Tirath5504's picture
Update app.py
6f3b51a verified
raw
history blame contribute delete
538 Bytes
import gradio as gr
from transformers import pipeline
import torch
classifier = pipeline(
"text-classification",
model="Tirath5504/IPD-Text-Hinglish",
device=0 if torch.cuda.is_available() else -1
)
def classify_text(text):
result = classifier(text)
return result[0]['label'], result[0]['score']
with gr.Interface(
fn=classify_text,
inputs=[gr.Textbox(label="Input Text")],
outputs=[gr.Textbox(label="Predicted Label"), gr.Number(label="Prediction Score")],
live=False
) as demo:
demo.launch()