Oscar Wang commited on
Commit
24955d5
·
verified ·
1 Parent(s): c04abc5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
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
- # Tokenize the input text
13
- inputs = tokenizer(text, return_tensors='pt', padding=True, truncation=True, max_length=128)
 
 
 
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():