first commit
Browse files- .gitignore +3 -0
- app.py +14 -0
- requirements.txt +4 -0
.gitignore
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
flagged
|
2 |
+
.idea
|
3 |
+
venv
|
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
reader = pipeline("text-classification", model='Guihss/TypeBERT', trust_remote_code=True,
|
5 |
+
revision='main')
|
6 |
+
|
7 |
+
|
8 |
+
|
9 |
+
def predict(text):
|
10 |
+
return {s['label']: s['score'] for s in reader(text, top_k=None)}
|
11 |
+
|
12 |
+
|
13 |
+
iface = gr.Interface(fn=predict, inputs="text", outputs='label')
|
14 |
+
iface.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
torch
|
3 |
+
torchvision
|
4 |
+
torchaudio
|