Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,28 +1,25 @@
|
|
1 |
from summary_extractor import Extractor
|
2 |
from Tags_Extractor import Tags
|
3 |
from Clauses_Extractor import Clauses
|
4 |
-
from key_value_extractor import KeyValue
|
5 |
-
from incorrect_sentence_finder import IncorrectSentenceFinder
|
6 |
from pdftojson import PdftoJson
|
7 |
from headings_extractor import HeadingsExtractor
|
8 |
-
from incompletesentencefinder import IncompleteSentenceFinder
|
9 |
-
from aggressive_content_finder import AggressiveContentFinder
|
10 |
from extract_date import ExtractDateAndDuration
|
11 |
from pdftojson import PdftoJson
|
12 |
-
from ContractGenerator import ContractGenerator
|
13 |
-
from contract_missing_clausses import ContractMissingClauses
|
14 |
import gradio as gr
|
15 |
|
16 |
def file_output_fn(file_path):
|
17 |
file_path = file_path.name
|
18 |
return file_path
|
19 |
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
22 |
gr.HTML("""<center class="darkblue" text-align:center;padding:25px;'>
|
23 |
<be>
|
24 |
-
<h1 style="color:#
|
25 |
-
|
26 |
</h1>
|
27 |
</center>""")
|
28 |
with gr.Row(elem_id = "col-container",scale=0.80):
|
@@ -39,17 +36,17 @@ with gr.Blocks(css="style.css",theme='freddyaboulton/test-blue') as demo:
|
|
39 |
summary = gr.Textbox(label = "Summary",lines=10)
|
40 |
|
41 |
with gr.Row(elem_id = "col-container",scale=0.80):
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
with gr.TabItem("Tags"):
|
43 |
with gr.Column(elem_id = "col-container",scale=0.80):
|
44 |
tags_btn = gr.Button("Tags Extracter")
|
45 |
tags = gr.Textbox(label = "Tags", lines=10)
|
46 |
|
47 |
-
with gr.TabItem("Key Values"):
|
48 |
-
with gr.Column(elem_id = "col-container",scale=0.80):
|
49 |
-
key_value_btn = gr.Button("Key Value Extractor")
|
50 |
-
key_value = gr.Textbox(label = "Key Value",lines=10)
|
51 |
-
|
52 |
-
|
53 |
with gr.TabItem("Clauses"):
|
54 |
with gr.Column(elem_id = "col-container",scale=0.80):
|
55 |
clauses_btn = gr.Button("Clauses Extractor")
|
@@ -60,74 +57,26 @@ with gr.Blocks(css="style.css",theme='freddyaboulton/test-blue') as demo:
|
|
60 |
heading_btn = gr.Button("Headings Extractor")
|
61 |
heading = gr.Textbox(label = "Headings", lines=10)
|
62 |
|
63 |
-
with gr.TabItem("Incorrect_Sentence"):
|
64 |
-
with gr.Column(elem_id = "col-container",scale=0.80):
|
65 |
-
incor_sen_btn = gr.Button("Incorrect Sentence Extractor")
|
66 |
-
incorrect_sentence = gr.Textbox(label = "Incorrect Sentence", lines=10)
|
67 |
-
|
68 |
-
with gr.TabItem("Incomplete Sentence"):
|
69 |
-
with gr.Column(elem_id = "col-container",scale=0.80):
|
70 |
-
incom_sen_btn = gr.Button("Incomplete Sentence Extractor")
|
71 |
-
incomplete_sentence = gr.Textbox(label = "Incomplete Sentence", lines=10)
|
72 |
-
|
73 |
-
with gr.TabItem("Aggressive Content"):
|
74 |
-
with gr.Column(elem_id = "col-container",scale=0.80):
|
75 |
-
aggres_sen_btn = gr.Button("Aggressive Content Extractor")
|
76 |
-
aggressive_sentence = gr.Textbox(label = "Aggressive Content", lines=10)
|
77 |
-
|
78 |
with gr.TabItem("Extract Date"):
|
79 |
with gr.Column(elem_id = "col-container",scale=0.80):
|
80 |
extract_date_btn = gr.Button("Extract date")
|
81 |
-
extracted_date = gr.Textbox(label = "
|
82 |
-
|
83 |
-
with gr.TabItem("Pdf to Json"):
|
84 |
-
with gr.Column(elem_id = "col-container",scale=0.80):
|
85 |
-
extract_json_btn = gr.Button("Extract Json from PDF")
|
86 |
-
extracted_json = gr.Textbox(label = "Json", lines=10)
|
87 |
-
|
88 |
-
with gr.TabItem("Contract Generator"):
|
89 |
-
with gr.Column(elem_id = "col-container",scale=0.80):
|
90 |
-
prompt = gr.Textbox(label="Prompt")
|
91 |
-
generate_btn = gr.Button("Generate")
|
92 |
-
contract_box = gr.Textbox(label = "Contract", lines=10)
|
93 |
-
|
94 |
-
with gr.TabItem("Missing Features"):
|
95 |
-
with gr.Column(elem_id = "col-container",scale=0.80):
|
96 |
-
find_missing_features_btn = gr.Button("Find Missing Features")
|
97 |
-
Output_box = gr.Textbox(label = "Output", lines=10)
|
98 |
|
99 |
extractor = Extractor()
|
100 |
upload_button.upload(file_output_fn,upload_button,file_output)
|
101 |
summary_btn.click( extractor._refine_summary,[upload_button],summary)
|
102 |
|
|
|
|
|
103 |
|
104 |
tags_btn.click(Tags.extract_tags,summary,tags)
|
105 |
-
key_value_btn.click( KeyValue.extract_key_value_pair,summary,key_value)
|
106 |
clauses_btn.click(Clauses.get_extracted_clauses,summary,clauses)
|
107 |
|
108 |
ex= HeadingsExtractor()
|
109 |
heading_btn.click(ex.extract_text,upload_button,heading)
|
110 |
|
111 |
-
inf= IncorrectSentenceFinder()
|
112 |
-
incor_sen_btn.click(inf.get_incorrect_sentence,upload_button,incorrect_sentence)
|
113 |
-
|
114 |
-
inc= IncompleteSentenceFinder()
|
115 |
-
incom_sen_btn.click(inc.get_incomplete_sentence,upload_button,incomplete_sentence)
|
116 |
-
|
117 |
-
agg= AggressiveContentFinder()
|
118 |
-
aggres_sen_btn.click(agg.get_aggressive_content,upload_button,aggressive_sentence)
|
119 |
-
|
120 |
date = ExtractDateAndDuration()
|
121 |
extract_date_btn.click(date.itrate_each_page,upload_button,extracted_date)
|
122 |
|
123 |
-
|
124 |
-
extract_json_btn.click(pdftojson.extract_text_from_pdf,upload_button,extracted_json)
|
125 |
-
|
126 |
-
contract_gen = ContractGenerator()
|
127 |
-
generate_btn.click(contract_gen.generate_contract,prompt,contract_box)
|
128 |
-
|
129 |
-
cont_mis_clauses = ContractMissingClauses()
|
130 |
-
find_missing_features_btn.click(cont_mis_clauses.iterate_each_page,upload_button,Output_box)
|
131 |
-
|
132 |
-
|
133 |
-
demo.launch(debug=True)
|
|
|
1 |
from summary_extractor import Extractor
|
2 |
from Tags_Extractor import Tags
|
3 |
from Clauses_Extractor import Clauses
|
|
|
|
|
4 |
from pdftojson import PdftoJson
|
5 |
from headings_extractor import HeadingsExtractor
|
|
|
|
|
6 |
from extract_date import ExtractDateAndDuration
|
7 |
from pdftojson import PdftoJson
|
|
|
|
|
8 |
import gradio as gr
|
9 |
|
10 |
def file_output_fn(file_path):
|
11 |
file_path = file_path.name
|
12 |
return file_path
|
13 |
|
14 |
+
with gr.Blocks(css="style.css",theme=gr.themes.Soft()) as demo:
|
15 |
+
gr.HTML("""<center class="image" text-align:center;padding:25px;'>
|
16 |
+
<img src="https://www.seekpng.com/png/detail/344-3444951_hakuna-matata-solutions-pvt-ltd-logo-hakuna-matata.png">
|
17 |
+
|
18 |
+
</center>""")
|
19 |
gr.HTML("""<center class="darkblue" text-align:center;padding:25px;'>
|
20 |
<be>
|
21 |
+
<h1 style="color:#000; font-weight:bold; font-size:28px;">
|
22 |
+
Data Converstion
|
23 |
</h1>
|
24 |
</center>""")
|
25 |
with gr.Row(elem_id = "col-container",scale=0.80):
|
|
|
36 |
summary = gr.Textbox(label = "Summary",lines=10)
|
37 |
|
38 |
with gr.Row(elem_id = "col-container",scale=0.80):
|
39 |
+
|
40 |
+
with gr.TabItem("Meta Data"):
|
41 |
+
with gr.Column(elem_id = "col-container",scale=0.80):
|
42 |
+
extract_json_btn = gr.Button("Extract Meta data")
|
43 |
+
extracted_json = gr.Textbox(label = "Meta data", lines=10)
|
44 |
+
|
45 |
with gr.TabItem("Tags"):
|
46 |
with gr.Column(elem_id = "col-container",scale=0.80):
|
47 |
tags_btn = gr.Button("Tags Extracter")
|
48 |
tags = gr.Textbox(label = "Tags", lines=10)
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
with gr.TabItem("Clauses"):
|
51 |
with gr.Column(elem_id = "col-container",scale=0.80):
|
52 |
clauses_btn = gr.Button("Clauses Extractor")
|
|
|
57 |
heading_btn = gr.Button("Headings Extractor")
|
58 |
heading = gr.Textbox(label = "Headings", lines=10)
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
with gr.TabItem("Extract Date"):
|
61 |
with gr.Column(elem_id = "col-container",scale=0.80):
|
62 |
extract_date_btn = gr.Button("Extract date")
|
63 |
+
extracted_date = gr.Textbox(label = "Extracted date", lines=10)
|
64 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
extractor = Extractor()
|
67 |
upload_button.upload(file_output_fn,upload_button,file_output)
|
68 |
summary_btn.click( extractor._refine_summary,[upload_button],summary)
|
69 |
|
70 |
+
pdftojson = PdftoJson()
|
71 |
+
extract_json_btn.click(pdftojson.extract_text_from_pdf,upload_button,extracted_json)
|
72 |
|
73 |
tags_btn.click(Tags.extract_tags,summary,tags)
|
|
|
74 |
clauses_btn.click(Clauses.get_extracted_clauses,summary,clauses)
|
75 |
|
76 |
ex= HeadingsExtractor()
|
77 |
heading_btn.click(ex.extract_text,upload_button,heading)
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
date = ExtractDateAndDuration()
|
80 |
extract_date_btn.click(date.itrate_each_page,upload_button,extracted_date)
|
81 |
|
82 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|