Spaces:
Runtime error
Runtime error
HeshamHaroon
commited on
Commit
•
6f9d03f
1
Parent(s):
3567a04
Update app.py
Browse files
app.py
CHANGED
@@ -29,35 +29,32 @@ def compare_tokenizers(tokenizer_name, text):
|
|
29 |
# Prepare the results to be displayed
|
30 |
results = [(tokenizer_name, tokens, encoded_output, decoded_text)]
|
31 |
return results
|
32 |
-
|
33 |
-
# Define the Gradio interface components with a dropdown for model selection
|
34 |
inputs_component = [
|
35 |
gr.Dropdown(choices=tokenizer_options, label="Select Tokenizer"),
|
36 |
gr.Textbox(lines=2, placeholder="Enter Arabic text here...", label="Input Text")
|
37 |
]
|
38 |
|
39 |
-
#
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
title="AraNizer Tokenizer Comparison")
|
61 |
|
62 |
# Launching the Gradio app
|
63 |
-
iface.launch()
|
|
|
29 |
# Prepare the results to be displayed
|
30 |
results = [(tokenizer_name, tokens, encoded_output, decoded_text)]
|
31 |
return results
|
|
|
|
|
32 |
inputs_component = [
|
33 |
gr.Dropdown(choices=tokenizer_options, label="Select Tokenizer"),
|
34 |
gr.Textbox(lines=2, placeholder="Enter Arabic text here...", label="Input Text")
|
35 |
]
|
36 |
|
37 |
+
# Define the outputs component normally without the 'css' parameter
|
38 |
+
outputs_component = gr.Dataframe(headers=["Tokenizer", "Tokens", "Encoded Output", "Decoded Text"], label="Results")
|
39 |
+
|
40 |
+
# Applying a theme to modify global styles including font size, which might affect readability across components
|
41 |
+
custom_theme = theme.Theme(
|
42 |
+
# Adjust the primary colors, text sizes, spaces, etc., as necessary
|
43 |
+
font_size={
|
44 |
+
'small_text': 16,
|
45 |
+
'text': 18,
|
46 |
+
'big_text': 20,
|
47 |
+
'header': 24,
|
48 |
+
},
|
49 |
+
# Further theme adjustments can be made as needed
|
50 |
+
)
|
51 |
+
|
52 |
+
# Setting up the interface with the custom theme
|
53 |
+
iface = Interface(fn=compare_tokenizers,
|
54 |
+
inputs=inputs_component,
|
55 |
+
outputs=outputs_component,
|
56 |
+
title="AraNizer Tokenizer Comparison",
|
57 |
+
theme=custom_theme)
|
|
|
58 |
|
59 |
# Launching the Gradio app
|
60 |
+
iface.launch()
|