Spaces:
Running
Running
robertselvam
commited on
Commit
•
021aa42
1
Parent(s):
6537e7e
Update app.py
Browse files
app.py
CHANGED
@@ -10,13 +10,8 @@ from incompletesentencefinder import IncompleteSentenceFinder
|
|
10 |
from aggressive_content_finder import AggressiveContentFinder
|
11 |
import gradio as gr
|
12 |
|
13 |
-
overall_filepath = ''
|
14 |
def file_output_fn(file_path):
|
15 |
file_path = file_path.name
|
16 |
-
global overall_filepath
|
17 |
-
print("before",file_path)
|
18 |
-
overall_filepath = file_path
|
19 |
-
print("after",overall_filepath)
|
20 |
return file_path
|
21 |
|
22 |
#xiaobaiyuan/theme_land earneleh/paris
|
@@ -27,77 +22,75 @@ with gr.Blocks(css="style.css",theme='freddyaboulton/test-blue') as demo:
|
|
27 |
Contract
|
28 |
</h1>
|
29 |
</center>""")
|
30 |
-
with gr.
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
with gr.
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
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 |
-
upload_button.upload(file_output_fn,upload_button,file_output)
|
84 |
-
summary_btn.click( extractor._refine_summary,[upload_button],summary)
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
|
94 |
-
|
95 |
-
|
96 |
|
97 |
-
|
98 |
-
|
99 |
|
100 |
-
|
101 |
-
|
102 |
|
103 |
demo.launch(debug=True)
|
|
|
10 |
from aggressive_content_finder import AggressiveContentFinder
|
11 |
import gradio as gr
|
12 |
|
|
|
13 |
def file_output_fn(file_path):
|
14 |
file_path = file_path.name
|
|
|
|
|
|
|
|
|
15 |
return file_path
|
16 |
|
17 |
#xiaobaiyuan/theme_land earneleh/paris
|
|
|
22 |
Contract
|
23 |
</h1>
|
24 |
</center>""")
|
25 |
+
with gr.Row(elem_id = "col-container",scale=0.80):
|
26 |
+
with gr.Column(elem_id = "col-container",scale=0.80):
|
27 |
+
file_output = gr.File(label="File Status",elem_classes="filenameshow")
|
28 |
+
|
29 |
+
with gr.Column(elem_id = "col-container",scale=0.20):
|
30 |
+
upload_button = gr.UploadButton(
|
31 |
+
"Browse File",file_types=[".txt", ".pdf", ".doc", ".docx",".json",".csv"],
|
32 |
+
elem_classes="uploadbutton")
|
33 |
+
summary_btn = gr.Button("Get Summary",elem_classes="uploadbutton")
|
34 |
+
|
35 |
+
with gr.Row(elem_id = "col-container",scale=0.60):
|
36 |
+
summary = gr.Textbox(label = "Summary",lines=10)
|
37 |
+
|
38 |
+
with gr.Row(elem_id = "col-container",scale=0.80):
|
39 |
+
with gr.TabItem("Tags"):
|
40 |
+
with gr.Column(elem_id = "col-container",scale=0.80):
|
41 |
+
tags_btn = gr.Button("Tags Extracter")
|
42 |
+
tags = gr.Textbox(label = "Tags", lines=10)
|
43 |
+
|
44 |
+
with gr.TabItem("Key Values"):
|
45 |
+
with gr.Column(elem_id = "col-container",scale=0.80):
|
46 |
+
key_value_btn = gr.Button("Key Value Extractor")
|
47 |
+
key_value = gr.Textbox(label = "Key Value",lines=10)
|
48 |
+
|
49 |
+
|
50 |
+
with gr.TabItem("Clauses"):
|
51 |
+
with gr.Column(elem_id = "col-container",scale=0.80):
|
52 |
+
clauses_btn = gr.Button("Clauses Extractor")
|
53 |
+
clauses = gr.Textbox(label = "Clauses", lines=10)
|
54 |
+
|
55 |
+
with gr.TabItem("pdf"):
|
56 |
+
with gr.Column(elem_id = "col-container",scale=0.80):
|
57 |
+
heading_btn = gr.Button("Headings Extractor")
|
58 |
+
heading = gr.Textbox(label = "Headings", lines=10)
|
59 |
+
|
60 |
+
with gr.TabItem("Incorrect_Sentence"):
|
61 |
+
with gr.Column(elem_id = "col-container",scale=0.80):
|
62 |
+
incor_sen_btn = gr.Button("Incorrect Sentence Extractor")
|
63 |
+
incorrect_sentence = gr.Textbox(label = "Incorrect Sentence", lines=10)
|
64 |
+
|
65 |
+
with gr.TabItem("Incomplete Sentence"):
|
66 |
+
with gr.Column(elem_id = "col-container",scale=0.80):
|
67 |
+
incom_sen_btn = gr.Button("Incomplete Sentence Extractor")
|
68 |
+
incomplete_sentence = gr.Textbox(label = "Incomplete Sentence", lines=10)
|
69 |
+
|
70 |
+
with gr.TabItem("Aggressive Content"):
|
71 |
+
with gr.Column(elem_id = "col-container",scale=0.80):
|
72 |
+
aggres_sen_btn = gr.Button("Aggressive Content Extractor")
|
73 |
+
aggressive_sentence = gr.Textbox(label = "Aggressive Content", lines=10)
|
74 |
+
|
75 |
+
extractor = Extractor()
|
76 |
+
upload_button.upload(file_output_fn,upload_button,file_output)
|
77 |
+
summary_btn.click( extractor._refine_summary,[upload_button],summary)
|
|
|
|
|
78 |
|
79 |
+
|
80 |
+
tags_btn.click(Tags.extract_tags,summary,tags)
|
81 |
+
key_value_btn.click( KeyValue.extract_key_value_pair,summary,key_value)
|
82 |
+
clauses_btn.click(Clauses.get_extracted_clauses,summary,clauses)
|
83 |
+
|
84 |
+
ex= HeadingsExtractor()
|
85 |
+
heading_btn.click(ex.extract_text,upload_button,heading)
|
86 |
|
87 |
+
inf= IncorrectSentenceFinder()
|
88 |
+
incor_sen_btn.click(inf.get_incorrect_sentence,upload_button,incorrect_sentence)
|
89 |
|
90 |
+
inc= IncompleteSentenceFinder()
|
91 |
+
incom_sen_btn.click(inc.get_incomplete_sentence,upload_button,incomplete_sentence)
|
92 |
|
93 |
+
agg= AggressiveContentFinder()
|
94 |
+
aggres_sen_btn.click(agg.get_aggressive_content,upload_button,aggressive_sentence)
|
95 |
|
96 |
demo.launch(debug=True)
|