Add requirements
Browse files
app.py
CHANGED
|
@@ -6,14 +6,11 @@ label2id = {"Negative":0, "Positive":1}
|
|
| 6 |
|
| 7 |
# Load the tokenizer and model
|
| 8 |
tokenizer = AutoTokenizer.from_pretrained('distilbert/distilbert-base-uncased', add_prefix_space=True)
|
| 9 |
-
model = AutoModelForSequenceClassification.from_pretrained(
|
| 10 |
-
model="AmirRghp/distilbert-base-uncasedimdb-text-classification", num_labels=2, id2label=id2label, label2id=label2id)
|
| 11 |
|
| 12 |
# Create the pipeline
|
| 13 |
classifier = pipeline('text-classification', model=model, tokenizer=tokenizer)
|
| 14 |
|
| 15 |
-
# Load your model from your Hugging Face profile
|
| 16 |
-
classifier = pipeline('text-classification', model='AmirRghp/distilbert-base-uncasedimdb-text-classification')
|
| 17 |
|
| 18 |
def classify_text(text):
|
| 19 |
result = classifier(text)
|
|
|
|
| 6 |
|
| 7 |
# Load the tokenizer and model
|
| 8 |
tokenizer = AutoTokenizer.from_pretrained('distilbert/distilbert-base-uncased', add_prefix_space=True)
|
| 9 |
+
model = AutoModelForSequenceClassification.from_pretrained('AmirRghp/distilbert-base-uncasedimdb-text-classification')
|
|
|
|
| 10 |
|
| 11 |
# Create the pipeline
|
| 12 |
classifier = pipeline('text-classification', model=model, tokenizer=tokenizer)
|
| 13 |
|
|
|
|
|
|
|
| 14 |
|
| 15 |
def classify_text(text):
|
| 16 |
result = classifier(text)
|