Spaces:
Running
Running
naveenvenkatesh
commited on
Commit
•
417a9e0
1
Parent(s):
021aa42
Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,11 @@ from pdftojson import PdftoJson
|
|
8 |
from headings_extractor import HeadingsExtractor
|
9 |
from incompletesentencefinder import IncompleteSentenceFinder
|
10 |
from aggressive_content_finder import AggressiveContentFinder
|
|
|
|
|
|
|
|
|
|
|
11 |
import gradio as gr
|
12 |
|
13 |
def file_output_fn(file_path):
|
@@ -72,6 +77,32 @@ with gr.Blocks(css="style.css",theme='freddyaboulton/test-blue') as demo:
|
|
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)
|
@@ -91,6 +122,22 @@ with gr.Blocks(css="style.css",theme='freddyaboulton/test-blue') as demo:
|
|
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)
|
|
|
8 |
from headings_extractor import HeadingsExtractor
|
9 |
from incompletesentencefinder import IncompleteSentenceFinder
|
10 |
from aggressive_content_finder import AggressiveContentFinder
|
11 |
+
from extract_date import ExtractDateAndDuration
|
12 |
+
from invoice_extractor import InvoiceKeyValuePair
|
13 |
+
from pdftojson import PdftoJson
|
14 |
+
from ContractGenerator import ContractGenerator
|
15 |
+
from contract_missing_clausses import ContractMissingClauses
|
16 |
import gradio as gr
|
17 |
|
18 |
def file_output_fn(file_path):
|
|
|
77 |
aggres_sen_btn = gr.Button("Aggressive Content Extractor")
|
78 |
aggressive_sentence = gr.Textbox(label = "Aggressive Content", lines=10)
|
79 |
|
80 |
+
with gr.TabItem("Extract Date"):
|
81 |
+
with gr.Column(elem_id = "col-container",scale=0.80):
|
82 |
+
extract_date_btn = gr.Button("Extract date")
|
83 |
+
extracted_date = gr.Textbox(label = "Extract date", lines=10)
|
84 |
+
|
85 |
+
with gr.TabItem("Invoice"):
|
86 |
+
with gr.Column(elem_id = "col-container",scale=0.80):
|
87 |
+
extract_invoice_key_value = gr.Button("Extract Invoice Key Value")
|
88 |
+
extracted_invoice_key_value = gr.Textbox(label = "Extracted Key Value", lines=10)
|
89 |
+
|
90 |
+
with gr.TabItem("Pdf to Json"):
|
91 |
+
with gr.Column(elem_id = "col-container",scale=0.80):
|
92 |
+
extract_json_btn = gr.Button("Extract Json from PDF")
|
93 |
+
extracted_json = gr.Textbox(label = "Json", lines=10)
|
94 |
+
|
95 |
+
with gr.TabItem("Contract Generator"):
|
96 |
+
with gr.Column(elem_id = "col-container",scale=0.80):
|
97 |
+
prompt = gr.Textbox(label="Prompt")
|
98 |
+
generate_btn = gr.Button("Generate")
|
99 |
+
contract_box = gr.Textbox(label = "Contract", lines=10)
|
100 |
+
|
101 |
+
with gr.TabItem("Missing Features"):
|
102 |
+
with gr.Column(elem_id = "col-container",scale=0.80):
|
103 |
+
find_missing_features_btn = gr.Button("Find Missing Features")
|
104 |
+
Output_box = gr.Textbox(label = "Output", lines=10)
|
105 |
+
|
106 |
extractor = Extractor()
|
107 |
upload_button.upload(file_output_fn,upload_button,file_output)
|
108 |
summary_btn.click( extractor._refine_summary,[upload_button],summary)
|
|
|
122 |
incom_sen_btn.click(inc.get_incomplete_sentence,upload_button,incomplete_sentence)
|
123 |
|
124 |
agg= AggressiveContentFinder()
|
125 |
+
aggres_sen_btn.click(agg.get_aggressive_content,upload_button,aggressive_sentence)
|
126 |
+
|
127 |
+
date = ExtractDateAndDuration()
|
128 |
+
extract_date_btn.click(date.itrate_each_page,upload_button,extracted_date)
|
129 |
+
|
130 |
+
invoice = InvoiceKeyValuePair()
|
131 |
+
extract_invoice_key_value.click(invoice.extract_key_value_pair,upload_button,extracted_invoice_key_value)
|
132 |
+
|
133 |
+
pdftojson = PdftoJson()
|
134 |
+
extract_json_btn.click(pdftojson.extract_text_from_pdf,upload_button,extracted_json)
|
135 |
+
|
136 |
+
contract_gen = ContractGenerator()
|
137 |
+
generate_btn.click(contract_gen.generate_contract,prompt,contract_box)
|
138 |
+
|
139 |
+
cont_mis_clauses = ContractMissingClauses()
|
140 |
+
find_missing_features_btn(cont_mis_clauses.iterate_each_page,upload_button,Output_box)
|
141 |
+
|
142 |
+
|
143 |
demo.launch(debug=True)
|