Team Ai
Apppublic

sid22669/intent_classification

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
app.py25 linesDownload Raw Back to root
1import gradio as gr2import joblib3 4with open('intent_classifier', 'rb') as file:5    model = joblib.load(file)6 7with open('c_intent_vectorizer', 'rb') as file:8    vectorizer = joblib.load(file)9 10def preprocess_input(data):11  tokens = data.lower().split()12  filtered = [text for text in tokens if text.isalpha()]13  return ' '.join(filtered)14 15def predict(text):16    model_input = preprocess_input(text)17    vectorized_input = vectorizer.transform([model_input])18    prediction = model.predict(vectorized_input)19    return prediction20    21 22demo = gr.Interface(fn=predict, inputs="textbox", outputs="textbox")23 24demo.launch()25