HeshamHaroon commited on
Commit
6f9d03f
1 Parent(s): 3567a04

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -25
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
- # Custom CSS to make the dataframe bigger
40
- custom_css = '''
41
- <style>
42
- .output_dataframe .dataframe {
43
- width: auto !important; /* Adjust the width as needed, or use 'auto' */
44
- font-size: 16px; /* Increase font size */
45
- }
46
- .output_dataframe .dataframe tbody tr td {
47
- padding: 12px !important; /* Increase padding for table cells */
48
- }
49
- </style>
50
- '''
51
-
52
- outputs_component = gr.Dataframe(headers=["Tokenizer", "Tokens", "Encoded Output", "Decoded Text"],
53
- label="Results",
54
- css=custom_css)
55
-
56
- # Setting up the interface
57
- iface = Interface(fn=compare_tokenizers,
58
- inputs=inputs_component,
59
- outputs=outputs_component,
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()