Spaces:
Sleeping
Sleeping
Oscar Wang
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -9,8 +9,11 @@ model = RobertaForSequenceClassification.from_pretrained(model_path)
|
|
9 |
|
10 |
# Define the prediction function
|
11 |
def classify_text(text):
|
12 |
-
#
|
13 |
-
|
|
|
|
|
|
|
14 |
|
15 |
# Get the model's prediction
|
16 |
with torch.no_grad():
|
|
|
9 |
|
10 |
# Define the prediction function
|
11 |
def classify_text(text):
|
12 |
+
# Remove periods and new lines from the input text
|
13 |
+
cleaned_text = text.replace('.', '').replace('\n', ' ')
|
14 |
+
|
15 |
+
# Tokenize the cleaned input text
|
16 |
+
inputs = tokenizer(cleaned_text, return_tensors='pt', padding=True, truncation=True, max_length=128)
|
17 |
|
18 |
# Get the model's prediction
|
19 |
with torch.no_grad():
|