robertselvam commited on
Commit
c03e845
·
1 Parent(s): 4a83fc7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -47
app.py CHANGED
@@ -19,58 +19,59 @@ with gr.Blocks(css="style.css",theme='xiaobaiyuan/theme_brief') as demo:
19
  Contract
20
  </h1>
21
  </center>""")
22
- with gr.Tab("Contract Summary"):
23
- with gr.Row(elem_id = "col-container",scale=0.80):
24
- with gr.Column(elem_id = "col-container",scale=0.80):
25
- file_output = gr.File(label="File Status",elem_classes="filenameshow")
 
 
 
 
 
 
 
 
 
 
26
 
27
- with gr.Column(elem_id = "col-container",scale=0.20):
28
- upload_button = gr.UploadButton(
29
- "Browse File",file_types=[".txt", ".pdf", ".doc", ".docx",".json",".csv"],
30
- elem_classes="uploadbutton")
31
- summary_btn = gr.Button("Get Summary",elem_classes="uploadbutton")
32
 
33
- with gr.Row(elem_id = "col-container",scale=0.60):
34
- summary = gr.Textbox(label = "Summary")
35
-
36
- with gr.Row(elem_id = "col-container",scale=0.80):
37
- with gr.Tab("Tags"):
38
- with gr.Column(elem_id = "col-container",scale=0.80):
39
- tags_btn = gr.Button("Tags Extracter")
40
- tags = gr.Textbox(label = "Tags", lines=10)
41
-
42
- with gr.Tab("Key Values"):
43
- with gr.Column(elem_id = "col-container",scale=0.80):
44
- key_value_btn = gr.Button("Key Value Extracter")
45
- key_value = gr.Textbox(label = "Key Value",lines=10)
46
-
47
-
48
- with gr.Tab("Clauses"):
49
- with gr.Column(elem_id = "col-container",scale=0.80):
50
- clauses_btn = gr.Button("Clauses Extracter")
51
- clauses = gr.Textbox(label = "Clauses", lines=10)
52
-
53
- extractor = Extractor()
54
- upload_button.upload(file_output_fn,upload_button,file_output)
55
- summary_btn.click( extractor._refine_summary,[upload_button],summary)
56
-
57
- tags_btn.click(Tags.extract_tags,summary,tags)
58
- key_value_btn.click( KeyValue.extract_key_value_pair,summary,key_value)
59
- clauses_btn.click(Clauses.get_extracted_clauses,summary,clauses)
60
 
61
- with gr.Tab("pdf"):
62
- with gr.Row(elem_id = "col-container",scale=0.80):
63
- with gr.Column(elem_id = "col-container",scale=0.80):
64
- file = gr.File(label="File",elem_classes="filenameshow")
65
 
66
- with gr.Column(elem_id = "col-container",scale=0.20):
67
- upload_button1 = gr.UploadButton(
68
- "Browse File",file_types=[".txt", ".pdf", ".doc", ".docx",".json",".csv"],
69
- elem_classes="uploadbutton")
70
- headings_btn = gr.Button("Get Headings",elem_classes="uploadbutton")
71
 
72
- with gr.Row(elem_id = "col-container",scale=0.60):
73
- headings = gr.Textbox(label = "Headings")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
  upload_button.upload(file_output_fn,upload_button1,file)
76
  headings_btn.click(HeadingsExtractor.extarct_text,upload_button1,headings)
 
19
  Contract
20
  </h1>
21
  </center>""")
22
+ with gr.Tab():
23
+ with gr.TabItem("Contract Summary"):
24
+ with gr.Row(elem_id = "col-container",scale=0.80):
25
+ with gr.Column(elem_id = "col-container",scale=0.80):
26
+ file_output = gr.File(label="File Status",elem_classes="filenameshow")
27
+
28
+ with gr.Column(elem_id = "col-container",scale=0.20):
29
+ upload_button = gr.UploadButton(
30
+ "Browse File",file_types=[".txt", ".pdf", ".doc", ".docx",".json",".csv"],
31
+ elem_classes="uploadbutton")
32
+ summary_btn = gr.Button("Get Summary",elem_classes="uploadbutton")
33
+
34
+ with gr.Row(elem_id = "col-container",scale=0.60):
35
+ summary = gr.Textbox(label = "Summary")
36
 
37
+ with gr.Row(elem_id = "col-container",scale=0.80):
38
+ with gr.Tab("Tags"):
39
+ with gr.Column(elem_id = "col-container",scale=0.80):
40
+ tags_btn = gr.Button("Tags Extracter")
41
+ tags = gr.Textbox(label = "Tags", lines=10)
42
 
43
+ with gr.Tab("Key Values"):
44
+ with gr.Column(elem_id = "col-container",scale=0.80):
45
+ key_value_btn = gr.Button("Key Value Extracter")
46
+ key_value = gr.Textbox(label = "Key Value",lines=10)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
 
 
 
 
48
 
49
+ with gr.Tab("Clauses"):
50
+ with gr.Column(elem_id = "col-container",scale=0.80):
51
+ clauses_btn = gr.Button("Clauses Extracter")
52
+ clauses = gr.Textbox(label = "Clauses", lines=10)
 
53
 
54
+ extractor = Extractor()
55
+ upload_button.upload(file_output_fn,upload_button,file_output)
56
+ summary_btn.click( extractor._refine_summary,[upload_button],summary)
57
+
58
+ tags_btn.click(Tags.extract_tags,summary,tags)
59
+ key_value_btn.click( KeyValue.extract_key_value_pair,summary,key_value)
60
+ clauses_btn.click(Clauses.get_extracted_clauses,summary,clauses)
61
+
62
+ with gr.TabItem("pdf"):
63
+ with gr.Row(elem_id = "col-container",scale=0.80):
64
+ with gr.Column(elem_id = "col-container",scale=0.80):
65
+ file = gr.File(label="File",elem_classes="filenameshow")
66
+
67
+ with gr.Column(elem_id = "col-container",scale=0.20):
68
+ upload_button1 = gr.UploadButton(
69
+ "Browse File",file_types=[".txt", ".pdf", ".doc", ".docx",".json",".csv"],
70
+ elem_classes="uploadbutton")
71
+ headings_btn = gr.Button("Get Headings",elem_classes="uploadbutton")
72
+
73
+ with gr.Row(elem_id = "col-container",scale=0.60):
74
+ headings = gr.Textbox(label = "Headings")
75
 
76
  upload_button.upload(file_output_fn,upload_button1,file)
77
  headings_btn.click(HeadingsExtractor.extarct_text,upload_button1,headings)