Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,7 +15,11 @@ emotion_classifier = pipeline("text-classification", model=emotion_model, tokeni
|
|
| 15 |
|
| 16 |
# Function to generate embeddings using AraBERT
|
| 17 |
def generate_embeddings(texts):
|
| 18 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
inputs = bert_tokenizer(texts, return_tensors="pt", padding=True, truncation=False, max_length=512)
|
| 20 |
|
| 21 |
# Split large sequences into chunks of size 512
|
|
|
|
| 15 |
|
| 16 |
# Function to generate embeddings using AraBERT
|
| 17 |
def generate_embeddings(texts):
|
| 18 |
+
# Ensure texts is a list of strings
|
| 19 |
+
if isinstance(texts, str): # If single string, convert to list
|
| 20 |
+
texts = [texts]
|
| 21 |
+
|
| 22 |
+
# Tokenize the list of strings (ensure all are strings)
|
| 23 |
inputs = bert_tokenizer(texts, return_tensors="pt", padding=True, truncation=False, max_length=512)
|
| 24 |
|
| 25 |
# Split large sequences into chunks of size 512
|