robertselvam commited on
Commit
f73df00
1 Parent(s): 52e6754

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -76
app.py CHANGED
@@ -10,48 +10,6 @@ def file_output_fn(file_path):
10
  file_path = file_path.name
11
  return file_path
12
 
13
- # with gr.Blocks(css="style.css",theme='xiaobaiyuan/theme_brief') as demo:
14
- # gr.HTML("""<center class="darkblue" style='background-color:#ad6e07; text-align:center;padding:25px;'>
15
- # <be>
16
- # <h1 style="color:#fff">
17
- # Contract Management
18
- # </h1>
19
- # </center>""")
20
- # with gr.Column(elem_id = "col-container",scale=0.10, min_width=160):
21
- # upload_button = gr.UploadButton(
22
- # "Browse File",file_types=[".txt", ".pdf", ".doc", ".docx",".json",".csv"],
23
- # elem_classes="filenameshow")
24
-
25
- # summary = gr.Textbox(label = "Summary")
26
- # extractor = Extractor()
27
-
28
- # upload_button.upload( extractor._refine_summary,[upload_button],summary)
29
- # with gr.Tab("Tags"):
30
- # with gr.Column(elem_id = "col-container"):
31
- # tags_btn = gr.Button("Tags Extractor")
32
- # tags = gr.Textbox(lines=4,label = "Tags")
33
- # tags_btn.click(Tags.extract_tags,summary,tags)
34
-
35
- # with gr.Tab("Key Values"):
36
- # with gr.Column(elem_id = "col-container"):
37
- # key_value_btn = gr.Button("Key Value Extractor")
38
- # key_value = gr.Textbox(label = "Key Value")
39
-
40
- # key_value_btn.click( KeyValue.extract_key_value_pair,summary,key_value)
41
-
42
- # with gr.Tab("Clauses"):
43
- # with gr.Column(elem_id = "col-container"):
44
- # clauses_btn = gr.Button("Clauses Extractor")
45
- # clauses = gr.Textbox(label = "Clauses")
46
-
47
- # clauses_btn.click(Clauses.get_extracted_clauses,summary,clauses)
48
-
49
- # # with gr.Tab("pdf to json"):
50
- # # with gr.Column(elem_id = "col-container"):
51
- # # pdf_to_json_btn = gr.Button("pdf to json Extractor")
52
- # # pdf_to_json = gr.Textbox(label = "Pdf to Json")
53
-
54
- # # pdf_to_json_btn.click(PdftoJson.extract_text_from_pdf,upload_button,pdf_to_json)
55
 
56
  with gr.Blocks(css="style.css",theme='xiaobaiyuan/theme_brief') as demo:
57
  gr.HTML("""<center class="darkblue" style='background-color:#ad6e07; text-align:center;padding:25px;'>
@@ -60,43 +18,45 @@ with gr.Blocks(css="style.css",theme='xiaobaiyuan/theme_brief') as demo:
60
  Contract
61
  </h1>
62
  </center>""")
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
- with gr.Row(elem_id = "col-container",scale=0.80):
65
- with gr.Column(elem_id = "col-container",scale=0.80):
66
- file_output = gr.File(label="File Status",elem_classes="filenameshow")
 
 
67
 
68
- with gr.Column(elem_id = "col-container",scale=0.20):
69
- upload_button = gr.UploadButton(
70
- "Browse File",file_types=[".txt", ".pdf", ".doc", ".docx",".json",".csv"],
71
- elem_classes="uploadbutton")
72
- summary_btn = gr.Button("Get Summary",elem_classes="uploadbutton")
73
 
74
- with gr.Row(elem_id = "col-container",scale=0.60):
75
- summary = gr.Textbox(label = "Summary")
76
-
77
- with gr.Row(elem_id = "col-container",scale=0.80):
78
- with gr.Tab("Tags"):
79
- with gr.Column(elem_id = "col-container",scale=0.80):
80
- tags_btn = gr.Button("Tags Extracter")
81
- tags = gr.Textbox(label = "Tags", lines=10)
82
-
83
- with gr.Tab("Key Values"):
84
- with gr.Column(elem_id = "col-container",scale=0.80):
85
- key_value_btn = gr.Button("Key Value Extracter")
86
- key_value = gr.Textbox(label = "Key Value",lines=10)
87
-
88
-
89
- with gr.Tab("Clauses"):
90
- with gr.Column(elem_id = "col-container",scale=0.80):
91
- clauses_btn = gr.Button("Clauses Extracter")
92
- clauses = gr.Textbox(label = "Clauses", lines=10)
93
-
94
- extractor = Extractor()
95
- upload_button.upload(file_output_fn,upload_button,file_output)
96
- summary_btn.click( extractor._refine_summary,[upload_button],summary)
97
 
98
- tags_btn.click(Tags.extract_tags,summary,tags)
99
- key_value_btn.click( KeyValue.extract_key_value_pair,summary,key_value)
100
- clauses_btn.click(Clauses.get_extracted_clauses,summary,clauses)
 
 
 
 
 
 
 
 
 
 
 
101
 
102
  demo.launch(debug=True)
 
10
  file_path = file_path.name
11
  return file_path
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  with gr.Blocks(css="style.css",theme='xiaobaiyuan/theme_brief') as demo:
15
  gr.HTML("""<center class="darkblue" style='background-color:#ad6e07; text-align:center;padding:25px;'>
 
18
  Contract
19
  </h1>
20
  </center>""")
21
+ with gr.Tab("Contract Summary"):
22
+ with gr.Row(elem_id = "col-container",scale=0.80):
23
+ with gr.Column(elem_id = "col-container",scale=0.80):
24
+ file_output = gr.File(label="File Status",elem_classes="filenameshow")
25
+
26
+ with gr.Column(elem_id = "col-container",scale=0.20):
27
+ upload_button = gr.UploadButton(
28
+ "Browse File",file_types=[".txt", ".pdf", ".doc", ".docx",".json",".csv"],
29
+ elem_classes="uploadbutton")
30
+ summary_btn = gr.Button("Get Summary",elem_classes="uploadbutton")
31
+
32
+ with gr.Row(elem_id = "col-container",scale=0.60):
33
+ summary = gr.Textbox(label = "Summary")
34
 
35
+ with gr.Row(elem_id = "col-container",scale=0.80):
36
+ with gr.Tab("Tags"):
37
+ with gr.Column(elem_id = "col-container",scale=0.80):
38
+ tags_btn = gr.Button("Tags Extracter")
39
+ tags = gr.Textbox(label = "Tags", lines=10)
40
 
41
+ with gr.Tab("Key Values"):
42
+ with gr.Column(elem_id = "col-container",scale=0.80):
43
+ key_value_btn = gr.Button("Key Value Extracter")
44
+ key_value = gr.Textbox(label = "Key Value",lines=10)
 
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
+ with gr.Tab("Clauses"):
48
+ with gr.Column(elem_id = "col-container",scale=0.80):
49
+ clauses_btn = gr.Button("Clauses Extracter")
50
+ clauses = gr.Textbox(label = "Clauses", lines=10)
51
+
52
+ extractor = Extractor()
53
+ upload_button.upload(file_output_fn,upload_button,file_output)
54
+ summary_btn.click( extractor._refine_summary,[upload_button],summary)
55
+
56
+ tags_btn.click(Tags.extract_tags,summary,tags)
57
+ key_value_btn.click( KeyValue.extract_key_value_pair,summary,key_value)
58
+ clauses_btn.click(Clauses.get_extracted_clauses,summary,clauses)
59
+ with gr.Tab("Tags"):
60
+ pass
61
 
62
  demo.launch(debug=True)