Spaces:
Sleeping
Sleeping
Commit ·
d087090
1
Parent(s): 102cdee
Update aggressive_content_finder.py
Browse files- aggressive_content_finder.py +14 -13
aggressive_content_finder.py
CHANGED
|
@@ -10,11 +10,12 @@ class AggressiveContentFinder:
|
|
| 10 |
|
| 11 |
"""
|
| 12 |
|
| 13 |
-
def __init__(self):
|
| 14 |
"""
|
| 15 |
Initialize the AggressiveContentFinder with your OpenAI API key.
|
| 16 |
"""
|
| 17 |
# openai.api_key = openai_api_key
|
|
|
|
| 18 |
pass
|
| 19 |
|
| 20 |
def _extract_aggressive_content(self, contract_text: str) -> str:
|
|
@@ -58,9 +59,9 @@ class AggressiveContentFinder:
|
|
| 58 |
debugging.
|
| 59 |
"""
|
| 60 |
try:
|
| 61 |
-
print("path:",
|
| 62 |
# Open the multi-page PDF using PdfReader
|
| 63 |
-
pdf = PdfReader(
|
| 64 |
|
| 65 |
aggressive_terms = ""
|
| 66 |
|
|
@@ -83,18 +84,18 @@ class AggressiveContentFinder:
|
|
| 83 |
|
| 84 |
def gradio_interface(self):
|
| 85 |
with gr.Blocks(css="style.css",theme='xiaobaiyuan/theme_brief') as demo:
|
| 86 |
-
with gr.Row(elem_id = "col-container",scale=0.80):
|
| 87 |
-
with gr.Column(elem_id = "col-container",scale=0.80):
|
| 88 |
-
|
| 89 |
|
| 90 |
-
with gr.Column(elem_id = "col-container",scale=0.20):
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
aggressive_content = gr.Button("Get Aggressive Content",elem_classes="uploadbutton")
|
| 95 |
|
| 96 |
with gr.Row(elem_id = "col-container",scale=0.60):
|
| 97 |
headings = gr.Textbox(label = "Aggressive Content")
|
| 98 |
|
| 99 |
-
upload_button1.upload(self.file_output_fnn,upload_button1,file1)
|
| 100 |
-
aggressive_content.click(self.get_aggressive_content,
|
|
|
|
| 10 |
|
| 11 |
"""
|
| 12 |
|
| 13 |
+
def __init__(self,filepath):
|
| 14 |
"""
|
| 15 |
Initialize the AggressiveContentFinder with your OpenAI API key.
|
| 16 |
"""
|
| 17 |
# openai.api_key = openai_api_key
|
| 18 |
+
self.filepath = filepath
|
| 19 |
pass
|
| 20 |
|
| 21 |
def _extract_aggressive_content(self, contract_text: str) -> str:
|
|
|
|
| 59 |
debugging.
|
| 60 |
"""
|
| 61 |
try:
|
| 62 |
+
print("path:",self.filepath)
|
| 63 |
# Open the multi-page PDF using PdfReader
|
| 64 |
+
pdf = PdfReader(self.filepath)
|
| 65 |
|
| 66 |
aggressive_terms = ""
|
| 67 |
|
|
|
|
| 84 |
|
| 85 |
def gradio_interface(self):
|
| 86 |
with gr.Blocks(css="style.css",theme='xiaobaiyuan/theme_brief') as demo:
|
| 87 |
+
# with gr.Row(elem_id = "col-container",scale=0.80):
|
| 88 |
+
# with gr.Column(elem_id = "col-container",scale=0.80):
|
| 89 |
+
# file1 = gr.File(label="File",elem_classes="filenameshow")
|
| 90 |
|
| 91 |
+
# with gr.Column(elem_id = "col-container",scale=0.20):
|
| 92 |
+
# upload_button1 = gr.UploadButton(
|
| 93 |
+
# "Browse File",file_types=[".txt", ".pdf", ".doc", ".docx",".json",".csv"],
|
| 94 |
+
# elem_classes="uploadbutton")
|
| 95 |
+
# aggressive_content = gr.Button("Get Aggressive Content",elem_classes="uploadbutton")
|
| 96 |
|
| 97 |
with gr.Row(elem_id = "col-container",scale=0.60):
|
| 98 |
headings = gr.Textbox(label = "Aggressive Content")
|
| 99 |
|
| 100 |
+
# upload_button1.upload(self.file_output_fnn,upload_button1,file1)
|
| 101 |
+
aggressive_content.click(self.get_aggressive_content,[],headings)
|