SmitaGautam commited on
Commit
880688e
1 Parent(s): acd6eb1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -28
app.py CHANGED
@@ -1,28 +1,28 @@
1
- import gradio as gr
2
- from svm_predict import predict
3
-
4
- def process_sentence(sentence):
5
- words, tags = predict(sentence)
6
- return " ".join([f"<span style='color:green;'>{word}</span>_<span style='color:blue;'>{tag}</span>" for word, tag in zip(words, tags)])
7
-
8
- iface = gr.Interface(
9
- fn=process_sentence,
10
- inputs=gr.Textbox(label="Enter a sentence", lines=4),
11
- outputs=gr.HTML(label="NEI tagged sentence", elem_id="output-box"),
12
- css="""
13
- #input-box {
14
- width: 50%;
15
- height: 150px;
16
- }
17
- #output-box {
18
- overflow-y: scroll; /* Always allow vertical scrolling */
19
- padding: 10px;
20
- border-radius: 5px;
21
- box-sizing: border-box; /* Ensures padding is included */
22
- white-space: pre-wrap; /* Ensure the text wraps to avoid horizontal scrolling */
23
- }
24
- """,
25
- live=False
26
- )
27
-
28
- iface.launch()
 
1
+ import gradio as gr
2
+ from svm_predict import predict
3
+
4
+ def process_sentence(sentence):
5
+ words, tags = predict(sentence)
6
+ return " ".join([f"<span style='color:green;'>{word}</span>_<span style='color:blue;'>{tag}</span>" for word, tag in zip(words, tags)])
7
+
8
+ iface = gr.Interface(
9
+ fn=process_sentence,
10
+ inputs=gr.Textbox(label="Enter a sentence", lines=4),
11
+ outputs=gr.HTML(label="NEI tagged sentence", elem_id="output-box"),
12
+ css="""
13
+ #input-box {
14
+ width: 50%;
15
+ height: 150px;
16
+ }
17
+ #output-box {
18
+ overflow-y: scroll; /* Always allow vertical scrolling */
19
+ padding: 10px;
20
+ border-radius: 5px;
21
+ box-sizing: border-box; /* Ensures padding is included */
22
+ white-space: pre-wrap; /* Ensure the text wraps to avoid horizontal scrolling */
23
+ }
24
+ """,
25
+ live=False
26
+ )
27
+
28
+ iface.launch(share=True)