lg3394 commited on
Commit
7ebc89a
·
verified ·
1 Parent(s): b7bab80

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -4
app.py CHANGED
@@ -1,5 +1,14 @@
1
- from openai import OpenAI
2
- client = OpenAI()
3
 
4
- moderation = client.moderations.create(input="I want to kill them.")
5
- print(moderation)
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ classifier = pipeline("zero-shot-classification",
5
+ model="facebook/bart-large-mnli")
6
+
7
+ def do_action(text):
8
+ candidate_labels = ['gun control', 'abortion', 'gender transition', 'freedom of speech', 'immigration', 'taxes']
9
+ result = classifier(text, candidate_labels)
10
+
11
+ return result
12
+
13
+ iface = gr.Interface(fn=do_action, inputs="text", outputs="text")
14
+ iface.launch()