Update app.py
Browse files
app.py
CHANGED
@@ -4,16 +4,16 @@ import gradio as gr #this is in place of the streamlit of the HF video
|
|
4 |
|
5 |
title = "Saras second try at ChatBot"
|
6 |
description = "Based on a zero-shot-classification model (default facebook/bart-large-mnli)"
|
|
|
7 |
|
8 |
|
9 |
-
classifier = pipeline("zero-shot-classification")
|
10 |
-
|
11 |
#heres the prediction function tp predict the response and add it to history
|
12 |
def predict(input, history=[]):
|
|
|
13 |
# generate a response
|
14 |
response = classifier(
|
15 |
input,
|
16 |
-
candidate_labels=["education", "politics", "business"],
|
17 |
)
|
18 |
return response
|
19 |
|
@@ -22,6 +22,7 @@ gr.Interface(
|
|
22 |
fn=predict,
|
23 |
title=title,
|
24 |
description=description,
|
|
|
25 |
inputs=["text", "state"],
|
26 |
outputs=["chatbot", "state"],
|
27 |
theme="finlaymacklon/boxy_violet",
|
|
|
4 |
|
5 |
title = "Saras second try at ChatBot"
|
6 |
description = "Based on a zero-shot-classification model (default facebook/bart-large-mnli)"
|
7 |
+
examples = [["The president was elected last week then convicted of ten crimes and imprisoned, though he was paid $10,000 for his trouble"]]
|
8 |
|
9 |
|
|
|
|
|
10 |
#heres the prediction function tp predict the response and add it to history
|
11 |
def predict(input, history=[]):
|
12 |
+
classifier = pipeline("zero-shot-classification")
|
13 |
# generate a response
|
14 |
response = classifier(
|
15 |
input,
|
16 |
+
candidate_labels=["education", "politics", "business","law"],
|
17 |
)
|
18 |
return response
|
19 |
|
|
|
22 |
fn=predict,
|
23 |
title=title,
|
24 |
description=description,
|
25 |
+
examples=examples,
|
26 |
inputs=["text", "state"],
|
27 |
outputs=["chatbot", "state"],
|
28 |
theme="finlaymacklon/boxy_violet",
|