dipesh's picture
Add application file
d870d13
raw history blame
No virus
713 Bytes
import gradio as gr
import tensorflow as tf
from transformers import AutoTokenizer, TFAutoModelForSequenceClassification, TextClassificationPipeline
tokenizer = AutoTokenizer.from_pretrained("dipesh/Intent-Classification-Bert-Base-Cased")
model = TFAutoModelForSequenceClassification.from_pretrained("dipesh/Intent-Classification-Bert-Base-Cased")
intent_classifier = TextClassificationPipeline(model=model, tokenizer=tokenizer, return_all_scores=False,
framework='tf')
def predict(input_text):
ans = intent_classifier(input_text)
return ans[0]['label']
predict("hello")
iface = gr.Interface(fn=predict, inputs="text", outputs="text")
iface.launch()