Spaces:
Runtime error
Runtime error
musfiqdehan
commited on
Commit
•
9b0be64
1
Parent(s):
7b14761
Refactor user interface as Tabbed for PoS tagging
Browse files
app.py
CHANGED
@@ -53,85 +53,129 @@ with gr.Blocks(css="styles.css") as demo:
|
|
53 |
gr.HTML("<h1>Bangla PoS Taggers</h1>")
|
54 |
gr.HTML("<p>Parts of Speech (PoS) Tagging of Bangla Sentence using Bangla-English <strong>Word Alignment</strong></p>")
|
55 |
|
56 |
-
with gr.
|
57 |
-
with gr.
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
]
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
gr.
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
"Flair"
|
131 |
-
]
|
132 |
-
|
133 |
-
], inputs)
|
134 |
|
|
|
135 |
|
136 |
|
137 |
# Launch the Gradio app
|
|
|
53 |
gr.HTML("<h1>Bangla PoS Taggers</h1>")
|
54 |
gr.HTML("<p>Parts of Speech (PoS) Tagging of Bangla Sentence using Bangla-English <strong>Word Alignment</strong></p>")
|
55 |
|
56 |
+
with gr.Tab("Using Alignment"):
|
57 |
+
with gr.Row():
|
58 |
+
with gr.Column():
|
59 |
+
inputs = [
|
60 |
+
gr.Textbox(
|
61 |
+
label="Enter Bangla Sentence",
|
62 |
+
placeholder="বাংলা বাক্য লিখুন"
|
63 |
+
),
|
64 |
+
gr.Dropdown(
|
65 |
+
choices=["Google", "BanglaNMT", "MyMemory"],
|
66 |
+
label="Select a Translator"
|
67 |
+
),
|
68 |
+
gr.Dropdown(
|
69 |
+
choices=["Google-mBERT (Base-Multilingual)", "Neulab-AwesomeAlign (Bn-En-0.5M)", "BUET-BanglaBERT (Large)", "SagorSarker-BanglaBERT (Base)", "SentenceTransformers-LaBSE (Multilingual)"],
|
70 |
+
label="Select a Model"
|
71 |
+
),
|
72 |
+
gr.Dropdown(
|
73 |
+
choices=["spaCy", "NLTK", "Flair", "TextBlob"],
|
74 |
+
label="Select a PoS Tagger"
|
75 |
+
)
|
76 |
+
]
|
77 |
+
with gr.Row():
|
78 |
+
btn = gr.Button(value="Submit", variant="primary")
|
79 |
+
gr.ClearButton(inputs)
|
80 |
+
|
81 |
+
with gr.Column():
|
82 |
+
outputs = [
|
83 |
+
gr.Textbox(label="English Translation"),
|
84 |
+
RichTextbox(label="PoS Tags"),
|
85 |
+
gr.Textbox(label="PoS Tagging Accuracy (Based on Unknown(UNK) Tags)")
|
86 |
+
]
|
87 |
+
|
88 |
+
btn.click(bn_postagger, inputs, outputs)
|
89 |
+
|
90 |
+
gr.Examples([
|
91 |
+
[
|
92 |
+
"বাংলাদেশ দক্ষিণ এশিয়ার একটি সার্বভৌম রাষ্ট্র।",
|
93 |
+
"Google",
|
94 |
+
"Neulab-AwesomeAlign (Bn-En-0.5M)",
|
95 |
+
"NLTK"
|
96 |
+
],
|
97 |
+
[
|
98 |
+
"বাংলাদেশের সংবিধানিক নাম কি?",
|
99 |
+
"Google",
|
100 |
+
"Google-mBERT (Base-Multilingual)",
|
101 |
+
"spaCy"
|
102 |
+
],
|
103 |
+
[
|
104 |
+
"বাংলাদেশের সাংবিধানিক নাম গণপ্রজাতন্ত্রী বাংলাদেশ।",
|
105 |
+
"Google",
|
106 |
+
"Google-mBERT (Base-Multilingual)",
|
107 |
+
"TextBlob"
|
108 |
+
],
|
109 |
+
[
|
110 |
+
"তিনজনের কেউই বাবার পথ ধরে প্রযুক্তি দুনিয়ায় হাঁটেননি।",
|
111 |
+
"Google",
|
112 |
+
"Neulab-AwesomeAlign (Bn-En-0.5M)",
|
113 |
+
"spaCy"
|
114 |
+
],
|
115 |
+
[
|
116 |
+
"তিনজনের কেউই বাবার পথ ধরে প্রযুক্তি দুনিয়ায় হাঁটেননি।",
|
117 |
+
"BanglaNMT",
|
118 |
+
"Google-mBERT (Base-Multilingual)",
|
119 |
+
"spaCy"
|
120 |
+
],
|
121 |
+
[
|
122 |
+
"তিনজনের কেউই বাবার পথ ধরে প্রযুক্তি দুনিয়ায় হাঁটেননি।",
|
123 |
+
"MyMemory",
|
124 |
+
"Google-mBERT (Base-Multilingual)",
|
125 |
+
"spaCy"
|
126 |
+
],
|
127 |
+
[
|
128 |
+
"বিশ্বের আরও একটি সেরা ক্লাব।",
|
129 |
+
"Google",
|
130 |
+
"Neulab-AwesomeAlign (Bn-En-0.5M)",
|
131 |
+
"Flair"
|
132 |
]
|
133 |
|
134 |
+
], inputs)
|
135 |
+
|
136 |
+
with gr.Tab("Using Bangla Library"):
|
137 |
+
with gr.Row():
|
138 |
+
with gr.Column():
|
139 |
+
inputs = [
|
140 |
+
gr.Textbox(
|
141 |
+
label="Enter Bangla Sentence",
|
142 |
+
placeholder="বাংলা বাক্য লিখুন"
|
143 |
+
),
|
144 |
+
gr.Dropdown(
|
145 |
+
choices=["BNLTK", "SBNLTK"],
|
146 |
+
label="Select a Bangla NLP Library"
|
147 |
+
)
|
148 |
+
]
|
149 |
+
with gr.Row():
|
150 |
+
btn = gr.Button(value="Submit", variant="primary")
|
151 |
+
gr.ClearButton(inputs)
|
152 |
+
|
153 |
+
with gr.Column():
|
154 |
+
outputs = [
|
155 |
+
RichTextbox(label="PoS Tags")
|
156 |
+
]
|
157 |
+
|
158 |
+
btn.click(bn_postagger, inputs, outputs)
|
159 |
+
|
160 |
+
gr.Examples([
|
161 |
+
[
|
162 |
+
"বাংলাদেশ দক্ষিণ এশিয়ার একটি সার্বভৌম রাষ্ট্র।",
|
163 |
+
"BNLTK"
|
164 |
+
],
|
165 |
+
[
|
166 |
+
"বাংলাদেশের সংবিধানিক নাম কি?",
|
167 |
+
"SBNLTK"
|
168 |
+
],
|
169 |
+
[
|
170 |
+
"বাংলাদেশের সাংবিধানিক নাম গণপ্রজাতন্ত্রী বাংলাদেশ।",
|
171 |
+
"SBNLTK"
|
172 |
+
],
|
173 |
+
[
|
174 |
+
"তিনজনের কেউই বাবার পথ ধরে প্রযুক্তি দুনিয়ায় হাঁটেননি।",
|
175 |
+
"BNLTK"
|
176 |
+
]
|
|
|
|
|
|
|
|
|
177 |
|
178 |
+
], inputs)
|
179 |
|
180 |
|
181 |
# Launch the Gradio app
|