Spaces:
Sleeping
Sleeping
madhavkotecha
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -10,8 +10,7 @@ import re
|
|
10 |
import gradio as gr
|
11 |
lancaster = LancasterStemmer()
|
12 |
|
13 |
-
|
14 |
-
nltk.download('universal_tagset')
|
15 |
|
16 |
class CRF_POS_Tagger:
|
17 |
def __init__(self):
|
@@ -222,13 +221,20 @@ class CRF_POS_Tagger:
|
|
222 |
features = [self.word_features(sentence_list, i) for i in range(len(sentence_list))]
|
223 |
|
224 |
predicted_tags = self.crf_model.predict([features])
|
225 |
-
output = "".join(f"{sentence[i]}[{predicted_tags[0][i]}]
|
226 |
return output
|
227 |
|
228 |
tagger = CRF_POS_Tagger()
|
229 |
interface = gr.Interface(fn = tagger.tagging,
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
import gradio as gr
|
11 |
lancaster = LancasterStemmer()
|
12 |
|
13 |
+
|
|
|
14 |
|
15 |
class CRF_POS_Tagger:
|
16 |
def __init__(self):
|
|
|
221 |
features = [self.word_features(sentence_list, i) for i in range(len(sentence_list))]
|
222 |
|
223 |
predicted_tags = self.crf_model.predict([features])
|
224 |
+
output = "".join(f"{sentence[i]}[{predicted_tags[0][i]}] " for i in range(len(sentence)))
|
225 |
return output
|
226 |
|
227 |
tagger = CRF_POS_Tagger()
|
228 |
interface = gr.Interface(fn = tagger.tagging,
|
229 |
+
inputs = gr.Textbox(
|
230 |
+
label="Input Sentence",
|
231 |
+
placeholder="Enter your sentence here...",
|
232 |
+
),
|
233 |
+
outputs = gr.Textbox(
|
234 |
+
label="Tagged Output",
|
235 |
+
placeholder="Tagged sentence appears here...",
|
236 |
+
),
|
237 |
+
title = "Conditional Random Field POS Tagger",
|
238 |
+
description = "CS626 Assignment 1B (Autumn 2024)",
|
239 |
+
theme=gr.themes.Soft())
|
240 |
+
interface.launch()
|