Spaces:
Runtime error
Runtime error
HeshamHaroon
commited on
Commit
•
3b0ce68
1
Parent(s):
5ad6fed
Update app.py
Browse files
app.py
CHANGED
@@ -42,13 +42,12 @@ def compare_tokenizers(tokenizer_name, text):
|
|
42 |
# AraNizer tokenizers
|
43 |
tokenizer = tokenizers[tokenizer_name]()
|
44 |
tokens = tokenizer.tokenize(text)
|
45 |
-
for token in tokens:
|
46 |
-
print(token.encode('utf-8').decode('utf-8'))
|
47 |
encoded_output = tokenizer.encode(text, add_special_tokens=True)
|
48 |
decoded_text = tokenizer.decode(encoded_output)
|
|
|
49 |
|
50 |
# Prepare the results to be displayed
|
51 |
-
results = [(tokenizer_name,
|
52 |
return results
|
53 |
|
54 |
# Define the Gradio interface components with a dropdown for model selection
|
|
|
42 |
# AraNizer tokenizers
|
43 |
tokenizer = tokenizers[tokenizer_name]()
|
44 |
tokens = tokenizer.tokenize(text)
|
|
|
|
|
45 |
encoded_output = tokenizer.encode(text, add_special_tokens=True)
|
46 |
decoded_text = tokenizer.decode(encoded_output)
|
47 |
+
tokens_arabic = [token.encode('utf-8').decode('utf-8') for token in tokens]
|
48 |
|
49 |
# Prepare the results to be displayed
|
50 |
+
results = [(tokenizer_name, tokens_arabic, encoded_output, decoded_text)]
|
51 |
return results
|
52 |
|
53 |
# Define the Gradio interface components with a dropdown for model selection
|