test2 / app.py
sbthesis's picture
Update app.py
857c438
raw
history blame
768 Bytes
from transformers import pipeline
import torch
import gradio as gr #this is in place of the streamlit of the HF video
title = "Saras second try at ChatBot"
description = "Based on a zero-shot-classification model (default facebook/bart-large-mnli)"
classifier = pipeline("zero-shot-classification")
#heres the prediction function tp predict the response and add it to history
def predict(input, history=[]):
# generate a response
response = classifier(
input,
candidate_labels=["education", "politics", "business"],
)
return response
gr.Interface(
fn=predict,
title=title,
description=description,
inputs=["text", "state"],
outputs=["chatbot", "state"],
theme="finlaymacklon/boxy_violet",
).launch()