Update app.py
Browse files
app.py
CHANGED
|
@@ -82,9 +82,9 @@ def bpe_app(input_text):
|
|
| 82 |
custom_css = """
|
| 83 |
<style>
|
| 84 |
body {
|
| 85 |
-
font-family: '
|
| 86 |
-
background: linear-gradient(135deg, #
|
| 87 |
-
color: #
|
| 88 |
}
|
| 89 |
.container {
|
| 90 |
max-width: 900px;
|
|
@@ -92,50 +92,67 @@ custom_css = """
|
|
| 92 |
padding: 20px;
|
| 93 |
}
|
| 94 |
.gradio-container {
|
| 95 |
-
background-color: rgba(255, 255, 255, 0.
|
| 96 |
border-radius: 15px;
|
| 97 |
-
|
|
|
|
| 98 |
}
|
| 99 |
h1 {
|
| 100 |
-
color: #
|
| 101 |
text-align: center;
|
| 102 |
font-size: 2.5em;
|
| 103 |
margin-bottom: 20px;
|
| 104 |
-
text-shadow: 2px 2px 4px rgba(0,0,0,0.
|
| 105 |
}
|
| 106 |
.gr-button {
|
| 107 |
-
background-color: #
|
| 108 |
border: none !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
}
|
| 110 |
.gr-button:hover {
|
| 111 |
-
background-color: #
|
|
|
|
|
|
|
| 112 |
}
|
| 113 |
.gr-form {
|
| 114 |
border-radius: 10px;
|
| 115 |
-
|
|
|
|
|
|
|
| 116 |
}
|
| 117 |
.gr-box {
|
| 118 |
border-radius: 8px;
|
| 119 |
-
border: 1px solid
|
| 120 |
padding: 15px;
|
| 121 |
margin-top: 10px;
|
| 122 |
-
background-color: rgba(255,
|
| 123 |
}
|
| 124 |
.gr-padded {
|
| 125 |
padding: 15px;
|
| 126 |
}
|
| 127 |
.gr-input, .gr-textarea {
|
| 128 |
-
|
|
|
|
| 129 |
border-radius: 8px !important;
|
|
|
|
| 130 |
}
|
| 131 |
.gr-input:focus, .gr-textarea:focus {
|
| 132 |
-
border-color: #
|
| 133 |
-
box-shadow: 0 0 0 2px rgba(
|
| 134 |
}
|
| 135 |
#component-0 {
|
| 136 |
border-radius: 10px;
|
| 137 |
overflow: hidden;
|
| 138 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
</style>
|
| 140 |
"""
|
| 141 |
|
|
@@ -143,7 +160,7 @@ custom_css = """
|
|
| 143 |
html_template = f"""
|
| 144 |
<div class="container">
|
| 145 |
<h1>🇮🇳 Byte Pair Encoding for Hindi</h1>
|
| 146 |
-
<p style="text-align: center; margin-bottom: 20px;">
|
| 147 |
Compress and tokenize Hindi text using the BPE algorithm.
|
| 148 |
Enter your text below or use one of the examples provided.
|
| 149 |
</p>
|
|
@@ -159,7 +176,7 @@ with gr.Blocks(css=custom_css) as iface:
|
|
| 159 |
input_text = gr.Textbox(lines=5, label="Input Hindi Text", placeholder="Enter Hindi text here or leave blank for an example")
|
| 160 |
|
| 161 |
with gr.Row():
|
| 162 |
-
submit_btn = gr.Button("Process")
|
| 163 |
|
| 164 |
with gr.Row():
|
| 165 |
with gr.Column():
|
|
@@ -180,5 +197,7 @@ with gr.Blocks(css=custom_css) as iface:
|
|
| 180 |
|
| 181 |
submit_btn.click(bpe_app, inputs=[input_text], outputs=[output_stats, output_encoded])
|
| 182 |
|
|
|
|
|
|
|
| 183 |
# Launch the app
|
| 184 |
iface.launch(inbrowser=True, share=True)
|
|
|
|
| 82 |
custom_css = """
|
| 83 |
<style>
|
| 84 |
body {
|
| 85 |
+
font-family: 'Poppins', sans-serif;
|
| 86 |
+
background: linear-gradient(135deg, #1e3c72, #2a5298);
|
| 87 |
+
color: #ffffff;
|
| 88 |
}
|
| 89 |
.container {
|
| 90 |
max-width: 900px;
|
|
|
|
| 92 |
padding: 20px;
|
| 93 |
}
|
| 94 |
.gradio-container {
|
| 95 |
+
background-color: rgba(255, 255, 255, 0.1);
|
| 96 |
border-radius: 15px;
|
| 97 |
+
backdrop-filter: blur(10px);
|
| 98 |
+
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
|
| 99 |
}
|
| 100 |
h1 {
|
| 101 |
+
color: #ffffff;
|
| 102 |
text-align: center;
|
| 103 |
font-size: 2.5em;
|
| 104 |
margin-bottom: 20px;
|
| 105 |
+
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
|
| 106 |
}
|
| 107 |
.gr-button {
|
| 108 |
+
background-color: #4CAF50 !important;
|
| 109 |
border: none !important;
|
| 110 |
+
color: white !important;
|
| 111 |
+
text-transform: uppercase;
|
| 112 |
+
font-weight: bold;
|
| 113 |
+
transition: all 0.3s ease;
|
| 114 |
}
|
| 115 |
.gr-button:hover {
|
| 116 |
+
background-color: #45a049 !important;
|
| 117 |
+
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
|
| 118 |
+
transform: translateY(-2px);
|
| 119 |
}
|
| 120 |
.gr-form {
|
| 121 |
border-radius: 10px;
|
| 122 |
+
background-color: rgba(255, 255, 255, 0.1);
|
| 123 |
+
padding: 20px;
|
| 124 |
+
margin-bottom: 20px;
|
| 125 |
}
|
| 126 |
.gr-box {
|
| 127 |
border-radius: 8px;
|
| 128 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 129 |
padding: 15px;
|
| 130 |
margin-top: 10px;
|
| 131 |
+
background-color: rgba(255, 255, 255, 0.05);
|
| 132 |
}
|
| 133 |
.gr-padded {
|
| 134 |
padding: 15px;
|
| 135 |
}
|
| 136 |
.gr-input, .gr-textarea {
|
| 137 |
+
background-color: rgba(255, 255, 255, 0.1) !important;
|
| 138 |
+
border: 2px solid rgba(255, 255, 255, 0.2) !important;
|
| 139 |
border-radius: 8px !important;
|
| 140 |
+
color: white !important;
|
| 141 |
}
|
| 142 |
.gr-input:focus, .gr-textarea:focus {
|
| 143 |
+
border-color: #4CAF50 !important;
|
| 144 |
+
box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2) !important;
|
| 145 |
}
|
| 146 |
#component-0 {
|
| 147 |
border-radius: 10px;
|
| 148 |
overflow: hidden;
|
| 149 |
}
|
| 150 |
+
.footer {
|
| 151 |
+
text-align: center;
|
| 152 |
+
margin-top: 20px;
|
| 153 |
+
font-size: 0.9em;
|
| 154 |
+
color: rgba(255, 255, 255, 0.7);
|
| 155 |
+
}
|
| 156 |
</style>
|
| 157 |
"""
|
| 158 |
|
|
|
|
| 160 |
html_template = f"""
|
| 161 |
<div class="container">
|
| 162 |
<h1>🇮🇳 Byte Pair Encoding for Hindi</h1>
|
| 163 |
+
<p style="text-align: center; margin-bottom: 20px; color: rgba(255, 255, 255, 0.8);">
|
| 164 |
Compress and tokenize Hindi text using the BPE algorithm.
|
| 165 |
Enter your text below or use one of the examples provided.
|
| 166 |
</p>
|
|
|
|
| 176 |
input_text = gr.Textbox(lines=5, label="Input Hindi Text", placeholder="Enter Hindi text here or leave blank for an example")
|
| 177 |
|
| 178 |
with gr.Row():
|
| 179 |
+
submit_btn = gr.Button("Process", variant="primary")
|
| 180 |
|
| 181 |
with gr.Row():
|
| 182 |
with gr.Column():
|
|
|
|
| 197 |
|
| 198 |
submit_btn.click(bpe_app, inputs=[input_text], outputs=[output_stats, output_encoded])
|
| 199 |
|
| 200 |
+
gr.HTML('<div class="footer">Developed with ❤️ for Hindi language processing</div>')
|
| 201 |
+
|
| 202 |
# Launch the app
|
| 203 |
iface.launch(inbrowser=True, share=True)
|