Commit
·
cc40b10
1
Parent(s):
5228e84
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,6 +12,7 @@ model_name = 'valurank/finetuned-distilbert-adult-content-detection'
|
|
| 12 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 13 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 14 |
|
|
|
|
| 15 |
def get_adult_content(text):
|
| 16 |
input_tensor = tokenizer.encode(text, return_tensors='pt', truncation=True)
|
| 17 |
logits = model(input_tensor).logits
|
|
@@ -28,6 +29,5 @@ demo = gr.Interface(get_adult_content, inputs = gr.inputs.Textbox(label= "Input
|
|
| 28 |
outputs = gr.outputs.Textbox(label='Category'))
|
| 29 |
|
| 30 |
|
| 31 |
-
|
| 32 |
if __name__ == "__main__":
|
| 33 |
demo.launch(debug=True)
|
|
|
|
| 12 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 13 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 14 |
|
| 15 |
+
|
| 16 |
def get_adult_content(text):
|
| 17 |
input_tensor = tokenizer.encode(text, return_tensors='pt', truncation=True)
|
| 18 |
logits = model(input_tensor).logits
|
|
|
|
| 29 |
outputs = gr.outputs.Textbox(label='Category'))
|
| 30 |
|
| 31 |
|
|
|
|
| 32 |
if __name__ == "__main__":
|
| 33 |
demo.launch(debug=True)
|