Spaces:
Running
Running
Add version retrieval for Turkish Tokenizer package and update footer in Gradio interface to display version number.
Browse files
app.py
CHANGED
@@ -1,6 +1,13 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
from turkish_tokenizer import TokenType, TurkishTokenizer
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
tokenizer = TurkishTokenizer()
|
5 |
|
6 |
# Define colors for each token type
|
@@ -77,10 +84,10 @@ custom_css = """
|
|
77 |
with gr.Blocks(theme=gr.themes.Soft(), title="Turkish Tokenizer", css=custom_css) as demo:
|
78 |
with gr.Row():
|
79 |
with gr.Column(scale=3):
|
80 |
-
gr.Markdown("""
|
81 |
# Turkish Tokenizer
|
82 |
### Advanced Turkish Text Tokenization with Visual Analysis
|
83 |
-
Enter text to see how it's tokenized. Tokens are color-coded by type.
|
84 |
""")
|
85 |
|
86 |
input_text = gr.Textbox(
|
@@ -126,7 +133,7 @@ with gr.Blocks(theme=gr.themes.Soft(), title="Turkish Tokenizer", css=custom_css
|
|
126 |
stats_output = gr.HTML(label="")
|
127 |
|
128 |
|
129 |
-
gr.Markdown("--- \n **Turkish Tokenizer
|
130 |
|
131 |
# --- Event Handlers ---
|
132 |
def process_with_theme(text):
|
|
|
1 |
import gradio as gr
|
2 |
+
import pkg_resources
|
3 |
from turkish_tokenizer import TokenType, TurkishTokenizer
|
4 |
|
5 |
+
# Get the version from the installed package
|
6 |
+
try:
|
7 |
+
VERSION = pkg_resources.get_distribution("turkish-tokenizer").version
|
8 |
+
except:
|
9 |
+
VERSION = "unknown"
|
10 |
+
|
11 |
tokenizer = TurkishTokenizer()
|
12 |
|
13 |
# Define colors for each token type
|
|
|
84 |
with gr.Blocks(theme=gr.themes.Soft(), title="Turkish Tokenizer", css=custom_css) as demo:
|
85 |
with gr.Row():
|
86 |
with gr.Column(scale=3):
|
87 |
+
gr.Markdown(f"""
|
88 |
# Turkish Tokenizer
|
89 |
### Advanced Turkish Text Tokenization with Visual Analysis
|
90 |
+
Enter text to see how it's tokenized. Tokens are color-coded by type.
|
91 |
""")
|
92 |
|
93 |
input_text = gr.Textbox(
|
|
|
133 |
stats_output = gr.HTML(label="")
|
134 |
|
135 |
|
136 |
+
gr.Markdown(f"--- \n **Turkish Tokenizer v{VERSION}** - Advanced tokenization for Turkish text.")
|
137 |
|
138 |
# --- Event Handlers ---
|
139 |
def process_with_theme(text):
|