Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app.py +14 -0
- requirments.txt +3 -0
app.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
|
| 3 |
+
|
| 4 |
+
model_name = "yazied49/disabilityy_model_final"
|
| 5 |
+
|
| 6 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 7 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 8 |
+
pipe = pipeline("text-classification", model=model, tokenizer=tokenizer)
|
| 9 |
+
|
| 10 |
+
def classify(text):
|
| 11 |
+
result = pipe(text)[0]
|
| 12 |
+
return f"Category: {result['label']}\nConfidence: {round(result['score'] * 100, 2)}%"
|
| 13 |
+
|
| 14 |
+
gr.Interface(fn=classify, inputs="text", outputs="text", title="Disability Classifier").launch()
|
requirments.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
transformers
|
| 2 |
+
torch
|
| 3 |
+
gradio
|