Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -40,9 +40,9 @@ def process_file(file):
|
|
40 |
is_contract_flag, classification = is_contract(text)
|
41 |
if is_contract_flag:
|
42 |
parties = extract_parties(text)
|
43 |
-
return "β
This is a contract.", parties
|
44 |
else:
|
45 |
-
return "β This is NOT a contract.",
|
46 |
|
47 |
# Gradio interface
|
48 |
iface = gr.Interface(
|
@@ -50,7 +50,7 @@ iface = gr.Interface(
|
|
50 |
inputs=gr.File(file_types=[".txt", ".pdf", ".docx"], label="Upload a document"),
|
51 |
outputs=[
|
52 |
gr.Textbox(label="Classification Result"),
|
53 |
-
gr.
|
54 |
],
|
55 |
title="Contract Classifier with RoBERTa",
|
56 |
description="Upload a document (.pdf, .txt, .docx) to detect if it's a contract and extract involved parties using RoBERTa."
|
|
|
40 |
is_contract_flag, classification = is_contract(text)
|
41 |
if is_contract_flag:
|
42 |
parties = extract_parties(text)
|
43 |
+
return "β
This is a contract.", ", ".join(parties)
|
44 |
else:
|
45 |
+
return "β This is NOT a contract.", ""
|
46 |
|
47 |
# Gradio interface
|
48 |
iface = gr.Interface(
|
|
|
50 |
inputs=gr.File(file_types=[".txt", ".pdf", ".docx"], label="Upload a document"),
|
51 |
outputs=[
|
52 |
gr.Textbox(label="Classification Result"),
|
53 |
+
gr.Textbox(label="Detected Parties (ORG/PER)")
|
54 |
],
|
55 |
title="Contract Classifier with RoBERTa",
|
56 |
description="Upload a document (.pdf, .txt, .docx) to detect if it's a contract and extract involved parties using RoBERTa."
|