Upload 5 files
Browse files- __init__.py +0 -0
- app.py +351 -4
- nda.txt +46 -0
- service_agreement.txt +54 -0
- software_license.txt +44 -0
__init__.py
ADDED
|
File without changes
|
app.py
CHANGED
|
@@ -1,7 +1,354 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
demo.launch()
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
CHEX — Contractual Hallucination Eliminator
|
| 3 |
+
HuggingFace Spaces Gradio Demo
|
| 4 |
+
|
| 5 |
+
Tab 1: Analyze Contract — paste a contract, ask a question, get a structured answer
|
| 6 |
+
Tab 2: Benchmark Demo — side-by-side table showing base model hallucinations vs CHEX
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
from __future__ import annotations
|
| 10 |
+
|
| 11 |
+
import os
|
| 12 |
+
import sys
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
from typing import Optional
|
| 15 |
+
|
| 16 |
import gradio as gr
|
| 17 |
|
| 18 |
+
sys.path.insert(0, str(Path(__file__).parent.parent))
|
| 19 |
+
|
| 20 |
+
# ---------------------------------------------------------------------------
|
| 21 |
+
# Model loading
|
| 22 |
+
# ---------------------------------------------------------------------------
|
| 23 |
+
|
| 24 |
+
MODEL_PATH = os.environ.get(
|
| 25 |
+
"HF_MODEL_REPO", "PLACEHOLDER/contractual-hallucination-eliminator"
|
| 26 |
+
)
|
| 27 |
+
SAMPLE_DIR = Path(__file__).parent / "sample_contracts"
|
| 28 |
+
|
| 29 |
+
analyzer = None
|
| 30 |
+
model_load_error: Optional[str] = None
|
| 31 |
+
|
| 32 |
+
try:
|
| 33 |
+
from serving.inference import ContractAnalyzer # type: ignore
|
| 34 |
+
|
| 35 |
+
analyzer = ContractAnalyzer(model_path=MODEL_PATH)
|
| 36 |
+
print(f"Model loaded successfully: {MODEL_PATH}")
|
| 37 |
+
except Exception as e:
|
| 38 |
+
model_load_error = str(e)
|
| 39 |
+
print(f"WARNING: Model failed to load: {e}")
|
| 40 |
+
print("Demo is running in preview mode — analysis will return a placeholder response.")
|
| 41 |
+
|
| 42 |
+
# ---------------------------------------------------------------------------
|
| 43 |
+
# Sample contract content
|
| 44 |
+
# ---------------------------------------------------------------------------
|
| 45 |
+
|
| 46 |
+
def _read_sample(filename: str) -> str:
|
| 47 |
+
p = SAMPLE_DIR / filename
|
| 48 |
+
if p.exists():
|
| 49 |
+
return p.read_text(encoding="utf-8")
|
| 50 |
+
return f"[Sample contract '{filename}' not found. Place it in demo/sample_contracts/]"
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
SOFTWARE_LICENSE = _read_sample("software_license.txt")
|
| 54 |
+
NDA = _read_sample("nda.txt")
|
| 55 |
+
SERVICE_AGREEMENT = _read_sample("service_agreement.txt")
|
| 56 |
+
|
| 57 |
+
# Suggested questions for each sample contract
|
| 58 |
+
SAMPLE_QUESTIONS = {
|
| 59 |
+
"software_license.txt": "What is the limitation of liability in this agreement?",
|
| 60 |
+
"nda.txt": "Does this agreement include a non-compete clause?",
|
| 61 |
+
"service_agreement.txt": "Does this contract include a termination for convenience clause?",
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
# ---------------------------------------------------------------------------
|
| 65 |
+
# Label badge HTML
|
| 66 |
+
# ---------------------------------------------------------------------------
|
| 67 |
+
|
| 68 |
+
BADGE_COLORS = {
|
| 69 |
+
"GROUNDED": "#22c55e",
|
| 70 |
+
"ABSENT": "#ef4444",
|
| 71 |
+
"CONTRADICTS_PRIOR": "#f59e0b",
|
| 72 |
+
"N/A": "#6b7280",
|
| 73 |
+
"ERROR": "#dc2626",
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
BADGE_ICONS = {
|
| 77 |
+
"GROUNDED": "✓",
|
| 78 |
+
"ABSENT": "✗",
|
| 79 |
+
"CONTRADICTS_PRIOR": "⚠",
|
| 80 |
+
"N/A": "—",
|
| 81 |
+
"ERROR": "!",
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
def format_label_html(label: str) -> str:
|
| 86 |
+
color = BADGE_COLORS.get(label, "#6b7280")
|
| 87 |
+
icon = BADGE_ICONS.get(label, "")
|
| 88 |
+
return (
|
| 89 |
+
f'<div style="background:{color}; color:white; padding:10px 20px; '
|
| 90 |
+
f'border-radius:8px; font-weight:bold; font-size:1.2em; text-align:center; '
|
| 91 |
+
f'letter-spacing:0.05em; margin:4px 0;">'
|
| 92 |
+
f'{icon} {label}</div>'
|
| 93 |
+
)
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
# ---------------------------------------------------------------------------
|
| 97 |
+
# Analysis handler
|
| 98 |
+
# ---------------------------------------------------------------------------
|
| 99 |
+
|
| 100 |
+
def analyze_contract(
|
| 101 |
+
contract_text: str,
|
| 102 |
+
question: str,
|
| 103 |
+
) -> tuple[str, str, str, str]:
|
| 104 |
+
"""
|
| 105 |
+
Returns (label_html, answer_text, citation_text, reasoning_text).
|
| 106 |
+
"""
|
| 107 |
+
if not contract_text.strip():
|
| 108 |
+
return format_label_html("N/A"), "", "", "Please paste a contract above."
|
| 109 |
+
if not question.strip():
|
| 110 |
+
return format_label_html("N/A"), "", "", "Please enter a question."
|
| 111 |
+
|
| 112 |
+
if analyzer is None:
|
| 113 |
+
return (
|
| 114 |
+
format_label_html("N/A"),
|
| 115 |
+
"Model not loaded",
|
| 116 |
+
"",
|
| 117 |
+
f"Model failed to load: {model_load_error}. "
|
| 118 |
+
"Set HF_MODEL_REPO in Space secrets to the correct model repo.",
|
| 119 |
+
)
|
| 120 |
+
|
| 121 |
+
try:
|
| 122 |
+
result = analyzer.analyze(contract_text, question)
|
| 123 |
+
label_html = format_label_html(result.label.value)
|
| 124 |
+
answer = result.answer if result.answer else "(none — clause is absent or not applicable)"
|
| 125 |
+
citation = result.citation if result.citation else "(none)"
|
| 126 |
+
reasoning = result.reasoning
|
| 127 |
+
return label_html, answer, citation, reasoning
|
| 128 |
+
except Exception as e:
|
| 129 |
+
return format_label_html("ERROR"), "", "", f"Inference error: {e}"
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
# ---------------------------------------------------------------------------
|
| 133 |
+
# Benchmark table data (hardcoded — pre-computed base model outputs)
|
| 134 |
+
# ---------------------------------------------------------------------------
|
| 135 |
+
|
| 136 |
+
import pandas as pd
|
| 137 |
+
|
| 138 |
+
BENCHMARK_ROWS = [
|
| 139 |
+
{
|
| 140 |
+
"Question": "What is the limitation of liability?",
|
| 141 |
+
"Ground Truth": "GROUNDED — $50,000 cap",
|
| 142 |
+
"Base Model (untuned)": "GROUNDED — $100,000 cap (wrong amount)",
|
| 143 |
+
"CHEX Fine-tuned": "GROUNDED — $50,000 cap ✓",
|
| 144 |
+
"Hallucinated?": "No (wrong value)",
|
| 145 |
+
},
|
| 146 |
+
{
|
| 147 |
+
"Question": "Does this contract include a non-compete clause?",
|
| 148 |
+
"Ground Truth": "ABSENT",
|
| 149 |
+
"Base Model (untuned)": "🚨 GROUNDED — 'Licensee shall not engage in competing activities...' (fabricated)",
|
| 150 |
+
"CHEX Fine-tuned": "ABSENT — null ✓",
|
| 151 |
+
"Hallucinated?": "YES",
|
| 152 |
+
},
|
| 153 |
+
{
|
| 154 |
+
"Question": "What is the term of the NDA?",
|
| 155 |
+
"Ground Truth": "GROUNDED — 3 years",
|
| 156 |
+
"Base Model (untuned)": "GROUNDED — 2 years (wrong duration)",
|
| 157 |
+
"CHEX Fine-tuned": "GROUNDED — three (3) years ✓",
|
| 158 |
+
"Hallucinated?": "No (wrong value)",
|
| 159 |
+
},
|
| 160 |
+
{
|
| 161 |
+
"Question": "Is there a termination for convenience clause?",
|
| 162 |
+
"Ground Truth": "ABSENT",
|
| 163 |
+
"Base Model (untuned)": "🚨 GROUNDED — 'Either party may terminate at any time...' (fabricated)",
|
| 164 |
+
"CHEX Fine-tuned": "ABSENT — null ✓",
|
| 165 |
+
"Hallucinated?": "YES",
|
| 166 |
+
},
|
| 167 |
+
{
|
| 168 |
+
"Question": "What are the monthly payment terms?",
|
| 169 |
+
"Ground Truth": "GROUNDED — $5,000/month",
|
| 170 |
+
"Base Model (untuned)": "GROUNDED — $5,000/month ✓",
|
| 171 |
+
"CHEX Fine-tuned": "GROUNDED — $5,000/month ✓",
|
| 172 |
+
"Hallucinated?": "No",
|
| 173 |
+
},
|
| 174 |
+
]
|
| 175 |
+
|
| 176 |
+
BENCHMARK_DF = pd.DataFrame(BENCHMARK_ROWS)
|
| 177 |
+
|
| 178 |
+
# ---------------------------------------------------------------------------
|
| 179 |
+
# Gradio UI
|
| 180 |
+
# ---------------------------------------------------------------------------
|
| 181 |
+
|
| 182 |
+
WARNING_HTML = ""
|
| 183 |
+
if model_load_error:
|
| 184 |
+
WARNING_HTML = (
|
| 185 |
+
'<div style="background:#fef3c7; border:2px solid #f59e0b; padding:12px 16px; '
|
| 186 |
+
'border-radius:8px; margin-bottom:12px; font-size:0.95em;">'
|
| 187 |
+
f'<strong>⚠ Model not loaded:</strong> {model_load_error}<br>'
|
| 188 |
+
'Set the <code>HF_MODEL_REPO</code> secret in your HuggingFace Space settings '
|
| 189 |
+
'to the correct model repository ID.'
|
| 190 |
+
'</div>'
|
| 191 |
+
)
|
| 192 |
+
|
| 193 |
+
with gr.Blocks(
|
| 194 |
+
title="CHEX — Contractual Hallucination Eliminator",
|
| 195 |
+
theme=gr.themes.Soft(),
|
| 196 |
+
) as demo:
|
| 197 |
+
gr.Markdown(
|
| 198 |
+
"# CHEX — Contractual Hallucination Eliminator\n"
|
| 199 |
+
"**Fine-tuned Qwen3.5-9B on AMD MI300X (ROCm)** — "
|
| 200 |
+
"detects hallucinations in contract analysis with calibrated uncertainty signals.\n\n"
|
| 201 |
+
"Instead of confidently fabricating answers, CHEX outputs one of three structured labels: "
|
| 202 |
+
"**GROUNDED** (answer exists), **ABSENT** (clause not present), or "
|
| 203 |
+
"**CONTRADICTS_PRIOR** (terms deviate from standard)."
|
| 204 |
+
)
|
| 205 |
+
|
| 206 |
+
if WARNING_HTML:
|
| 207 |
+
gr.HTML(WARNING_HTML)
|
| 208 |
+
|
| 209 |
+
with gr.Tabs():
|
| 210 |
+
# ------------------------------------------------------------------ #
|
| 211 |
+
# Tab 1: Analyze Contract #
|
| 212 |
+
# ------------------------------------------------------------------ #
|
| 213 |
+
with gr.Tab("Analyze Contract"):
|
| 214 |
+
with gr.Row():
|
| 215 |
+
# Left column: contract input
|
| 216 |
+
with gr.Column(scale=2):
|
| 217 |
+
gr.Markdown("### Contract Text")
|
| 218 |
+
contract_input = gr.Textbox(
|
| 219 |
+
label="Paste contract text here",
|
| 220 |
+
lines=22,
|
| 221 |
+
placeholder="Paste your contract text here, or load a sample contract below...",
|
| 222 |
+
show_label=False,
|
| 223 |
+
)
|
| 224 |
+
with gr.Row():
|
| 225 |
+
btn_software = gr.Button("Load: Software License", size="sm")
|
| 226 |
+
btn_nda = gr.Button("Load: NDA", size="sm")
|
| 227 |
+
btn_service = gr.Button("Load: Service Agreement", size="sm")
|
| 228 |
+
|
| 229 |
+
# Right column: question + results
|
| 230 |
+
with gr.Column(scale=1):
|
| 231 |
+
gr.Markdown("### Question")
|
| 232 |
+
question_input = gr.Textbox(
|
| 233 |
+
label="Question about the contract",
|
| 234 |
+
placeholder="e.g., What is the limitation of liability?",
|
| 235 |
+
lines=2,
|
| 236 |
+
show_label=False,
|
| 237 |
+
)
|
| 238 |
+
analyze_btn = gr.Button(
|
| 239 |
+
"Analyze",
|
| 240 |
+
variant="primary",
|
| 241 |
+
interactive=True,
|
| 242 |
+
)
|
| 243 |
+
|
| 244 |
+
gr.Markdown("### Result")
|
| 245 |
+
label_display = gr.HTML(
|
| 246 |
+
value=format_label_html("N/A"),
|
| 247 |
+
label="Classification",
|
| 248 |
+
)
|
| 249 |
+
answer_output = gr.Textbox(
|
| 250 |
+
label="Answer",
|
| 251 |
+
interactive=False,
|
| 252 |
+
lines=3,
|
| 253 |
+
)
|
| 254 |
+
citation_output = gr.Textbox(
|
| 255 |
+
label="Citation (verbatim from contract)",
|
| 256 |
+
interactive=False,
|
| 257 |
+
lines=3,
|
| 258 |
+
)
|
| 259 |
+
reasoning_output = gr.Textbox(
|
| 260 |
+
label="Reasoning",
|
| 261 |
+
interactive=False,
|
| 262 |
+
lines=2,
|
| 263 |
+
)
|
| 264 |
+
|
| 265 |
+
# Suggested questions shown when loading a sample
|
| 266 |
+
suggested_q = gr.Markdown("", visible=False)
|
| 267 |
+
|
| 268 |
+
# ------------------------------------------------------------------ #
|
| 269 |
+
# Tab 2: Benchmark Demo #
|
| 270 |
+
# ------------------------------------------------------------------ #
|
| 271 |
+
with gr.Tab("Benchmark Demo"):
|
| 272 |
+
gr.Markdown(
|
| 273 |
+
"## Base Qwen3.5-9B (untuned) vs. CHEX Fine-tuned Model\n\n"
|
| 274 |
+
"The table below shows 5 representative contract questions. "
|
| 275 |
+
"Rows marked with 🚨 show where the **base model hallucinated** "
|
| 276 |
+
"— it predicted GROUNDED (with a fabricated citation) when the correct "
|
| 277 |
+
"answer is **ABSENT** (the clause does not exist in the contract).\n\n"
|
| 278 |
+
"CHEX correctly returns ABSENT for all such cases."
|
| 279 |
+
)
|
| 280 |
+
|
| 281 |
+
gr.Dataframe(
|
| 282 |
+
value=BENCHMARK_DF,
|
| 283 |
+
headers=list(BENCHMARK_DF.columns),
|
| 284 |
+
datatype=["str"] * len(BENCHMARK_DF.columns),
|
| 285 |
+
wrap=True,
|
| 286 |
+
interactive=False,
|
| 287 |
+
)
|
| 288 |
+
|
| 289 |
+
gr.Markdown(
|
| 290 |
+
"### Key Insight\n"
|
| 291 |
+
"The base model (Qwen3.5-9B, zero-shot) hallucinates **2 out of 5** "
|
| 292 |
+
"examples — fabricating legal clauses that do not exist in the document.\n\n"
|
| 293 |
+
"CHEX (fine-tuned on AMD MI300X with LoRA) achieves **0 hallucinations** "
|
| 294 |
+
"on these examples by learning to distinguish between what the contract "
|
| 295 |
+
"actually says and what it doesn't say."
|
| 296 |
+
)
|
| 297 |
+
|
| 298 |
+
# ------------------------------------------------------------------ #
|
| 299 |
+
# Event handlers #
|
| 300 |
+
# ------------------------------------------------------------------ #
|
| 301 |
+
|
| 302 |
+
def load_software():
|
| 303 |
+
return (
|
| 304 |
+
SOFTWARE_LICENSE,
|
| 305 |
+
SAMPLE_QUESTIONS["software_license.txt"],
|
| 306 |
+
gr.update(value="💡 **Suggested question:** What is the limitation of liability in this agreement?", visible=True),
|
| 307 |
+
)
|
| 308 |
+
|
| 309 |
+
def load_nda():
|
| 310 |
+
return (
|
| 311 |
+
NDA,
|
| 312 |
+
SAMPLE_QUESTIONS["nda.txt"],
|
| 313 |
+
gr.update(value="💡 **Suggested question:** Does this agreement include a non-compete clause?", visible=True),
|
| 314 |
+
)
|
| 315 |
+
|
| 316 |
+
def load_service():
|
| 317 |
+
return (
|
| 318 |
+
SERVICE_AGREEMENT,
|
| 319 |
+
SAMPLE_QUESTIONS["service_agreement.txt"],
|
| 320 |
+
gr.update(value="💡 **Suggested question:** Does this contract include a termination for convenience clause? (expected: ABSENT)", visible=True),
|
| 321 |
+
)
|
| 322 |
+
|
| 323 |
+
btn_software.click(
|
| 324 |
+
fn=load_software,
|
| 325 |
+
inputs=[],
|
| 326 |
+
outputs=[contract_input, question_input, suggested_q],
|
| 327 |
+
)
|
| 328 |
+
btn_nda.click(
|
| 329 |
+
fn=load_nda,
|
| 330 |
+
inputs=[],
|
| 331 |
+
outputs=[contract_input, question_input, suggested_q],
|
| 332 |
+
)
|
| 333 |
+
btn_service.click(
|
| 334 |
+
fn=load_service,
|
| 335 |
+
inputs=[],
|
| 336 |
+
outputs=[contract_input, question_input, suggested_q],
|
| 337 |
+
)
|
| 338 |
+
|
| 339 |
+
analyze_btn.click(
|
| 340 |
+
fn=analyze_contract,
|
| 341 |
+
inputs=[contract_input, question_input],
|
| 342 |
+
outputs=[label_display, answer_output, citation_output, reasoning_output],
|
| 343 |
+
)
|
| 344 |
+
|
| 345 |
+
# Also trigger on Enter in question field
|
| 346 |
+
question_input.submit(
|
| 347 |
+
fn=analyze_contract,
|
| 348 |
+
inputs=[contract_input, question_input],
|
| 349 |
+
outputs=[label_display, answer_output, citation_output, reasoning_output],
|
| 350 |
+
)
|
| 351 |
+
|
| 352 |
|
| 353 |
+
if __name__ == "__main__":
|
| 354 |
+
demo.launch(show_error=True)
|
nda.txt
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
NON-DISCLOSURE AND NON-COMPETE AGREEMENT
|
| 2 |
+
|
| 3 |
+
This Non-Disclosure and Non-Compete Agreement ("Agreement") is entered into as of March 15, 2024 ("Effective Date"), between AlphaTech Solutions LLC, a California limited liability company ("Disclosing Party"), and Beta Dynamics Corp., a Texas corporation ("Receiving Party"), collectively referred to as the "Parties."
|
| 4 |
+
|
| 5 |
+
RECITALS
|
| 6 |
+
|
| 7 |
+
The Disclosing Party possesses certain confidential and proprietary information relating to its software development methodologies, customer lists, trade secrets, business strategies, and financial data (collectively, "Confidential Information"). The Parties desire to enter into discussions regarding a potential strategic partnership and wish to protect the Disclosing Party's Confidential Information during and after such discussions.
|
| 8 |
+
|
| 9 |
+
1. DEFINITION OF CONFIDENTIAL INFORMATION
|
| 10 |
+
|
| 11 |
+
"Confidential Information" means any and all information disclosed by the Disclosing Party to the Receiving Party, whether in oral, written, electronic, or any other form, that is designated as confidential or that reasonably should be understood to be confidential given the nature of the information and the circumstances of disclosure. Confidential Information includes, but is not limited to, technical data, trade secrets, know-how, research, product plans, products, services, customer lists, markets, software, and financial data.
|
| 12 |
+
|
| 13 |
+
2. NON-DISCLOSURE OBLIGATIONS
|
| 14 |
+
|
| 15 |
+
The Receiving Party shall: (a) hold all Confidential Information in strict confidence; (b) not disclose Confidential Information to any third party without the prior written consent of the Disclosing Party; (c) use Confidential Information solely for the purpose of evaluating the potential partnership; and (d) limit access to Confidential Information to employees who have a need to know and are bound by confidentiality obligations no less restrictive than those contained herein.
|
| 16 |
+
|
| 17 |
+
3. NON-COMPETE CLAUSE
|
| 18 |
+
|
| 19 |
+
During the term of this Agreement and for a period of two (2) years thereafter, the Receiving Party shall not, directly or indirectly, engage in, own, manage, operate, control, be employed by, provide services to, participate in, or be connected with any business activity that directly competes with the Disclosing Party's primary business operations in the geographic markets where the Disclosing Party currently operates or has documented plans to operate.
|
| 20 |
+
|
| 21 |
+
The Receiving Party further agrees not to solicit, hire, or attempt to hire any employee or contractor of the Disclosing Party during the same two (2) year period.
|
| 22 |
+
|
| 23 |
+
4. TERM
|
| 24 |
+
|
| 25 |
+
This Agreement shall commence on the Effective Date and remain in effect for a period of three (3) years from the date of execution, unless earlier terminated by mutual written consent of both Parties.
|
| 26 |
+
|
| 27 |
+
5. RETURN OF INFORMATION
|
| 28 |
+
|
| 29 |
+
Upon request by the Disclosing Party or upon termination of this Agreement, the Receiving Party shall promptly return or certify the destruction of all materials containing Confidential Information, including all copies, extracts, and summaries thereof.
|
| 30 |
+
|
| 31 |
+
6. EXCEPTIONS
|
| 32 |
+
|
| 33 |
+
The obligations under this Agreement shall not apply to information that: (a) is or becomes publicly available through no act of the Receiving Party; (b) was in the Receiving Party's possession prior to disclosure; (c) is independently developed by the Receiving Party without reference to the Confidential Information; or (d) is required to be disclosed by law or court order, provided that the Receiving Party gives prompt written notice to the Disclosing Party.
|
| 34 |
+
|
| 35 |
+
7. REMEDIES
|
| 36 |
+
|
| 37 |
+
The Receiving Party acknowledges that any breach of this Agreement may cause irreparable harm for which monetary damages would be an inadequate remedy. Accordingly, the Disclosing Party shall be entitled to seek injunctive relief in addition to all other remedies available at law or in equity.
|
| 38 |
+
|
| 39 |
+
8. GOVERNING LAW
|
| 40 |
+
|
| 41 |
+
This Agreement shall be governed by the laws of the State of California.
|
| 42 |
+
|
| 43 |
+
ALPHATECH SOLUTIONS LLC BETA DYNAMICS CORP.
|
| 44 |
+
By: ____________________ By: ____________________
|
| 45 |
+
Name: Dr. Priya Nair Name: Robert T. Caldwell
|
| 46 |
+
Title: Chief Technology Officer Title: President
|
service_agreement.txt
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
PROFESSIONAL SERVICES AGREEMENT
|
| 2 |
+
|
| 3 |
+
This Professional Services Agreement ("Agreement") is entered into as of February 1, 2024 ("Effective Date"), by and between Apex Consulting Group, Inc., a New York corporation with offices at 500 Fifth Avenue, New York, NY 10110 ("Service Provider"), and Meridian Enterprises, LLC, a Delaware limited liability company with offices at 2200 Corporate Blvd, Boca Raton, FL 33431 ("Client").
|
| 4 |
+
|
| 5 |
+
1. SCOPE OF SERVICES
|
| 6 |
+
|
| 7 |
+
Service Provider agrees to provide Client with strategic management consulting services as described in Exhibit A attached hereto ("Services"). Service Provider shall assign qualified personnel to perform the Services and shall complete all deliverables in accordance with the timelines specified in Exhibit A. Any changes to the scope of Services must be agreed upon in writing by both Parties.
|
| 8 |
+
|
| 9 |
+
2. PAYMENT TERMS
|
| 10 |
+
|
| 11 |
+
Client shall pay Service Provider a monthly retainer fee of Five Thousand Dollars ($5,000) per month. Payment is due and payable on the first business day of each calendar month. Client shall reimburse Service Provider for all pre-approved out-of-pocket expenses within fifteen (15) days of receipt of an itemized invoice. Any amounts not paid within thirty (30) days of the due date shall accrue interest at one percent (1%) per month.
|
| 12 |
+
|
| 13 |
+
3. TERM
|
| 14 |
+
|
| 15 |
+
This Agreement shall commence on the Effective Date and continue for an initial period of twelve (12) months. Thereafter, this Agreement shall automatically renew for successive twelve (12)-month periods unless either Party provides written notice of non-renewal at least sixty (60) days prior to the end of the then-current term.
|
| 16 |
+
|
| 17 |
+
4. TERMINATION FOR CAUSE
|
| 18 |
+
|
| 19 |
+
Either Party may terminate this Agreement upon thirty (30) days' prior written notice to the other Party if the other Party: (a) materially breaches any provision of this Agreement and fails to cure such breach within the thirty (30)-day notice period; (b) becomes insolvent, makes an assignment for the benefit of creditors, or is subject to any bankruptcy or insolvency proceeding; or (c) ceases to conduct business in the ordinary course.
|
| 20 |
+
|
| 21 |
+
Upon termination, Client shall pay Service Provider for all Services performed up to the date of termination and all non-cancellable expenses incurred by Service Provider through the termination date.
|
| 22 |
+
|
| 23 |
+
5. INDEPENDENT CONTRACTOR
|
| 24 |
+
|
| 25 |
+
Service Provider is an independent contractor and not an employee of Client. Nothing in this Agreement shall create a partnership, joint venture, or employment relationship between the Parties. Service Provider shall be solely responsible for all taxes, insurance, and benefits of its employees.
|
| 26 |
+
|
| 27 |
+
6. INTELLECTUAL PROPERTY
|
| 28 |
+
|
| 29 |
+
All work product, deliverables, and materials developed by Service Provider specifically for Client under this Agreement shall, upon full payment by Client, become the property of Client. Service Provider retains all right, title, and interest in and to its pre-existing tools, methodologies, frameworks, and know-how.
|
| 30 |
+
|
| 31 |
+
7. CONFIDENTIALITY
|
| 32 |
+
|
| 33 |
+
Each Party agrees to maintain the confidentiality of the other Party's proprietary business information disclosed in connection with this Agreement. This obligation shall survive the termination of this Agreement for a period of two (2) years.
|
| 34 |
+
|
| 35 |
+
8. INDEMNIFICATION
|
| 36 |
+
|
| 37 |
+
Each Party shall indemnify, defend, and hold harmless the other Party from and against any claims, damages, and expenses arising from such Party's gross negligence or willful misconduct in connection with this Agreement.
|
| 38 |
+
|
| 39 |
+
9. LIMITATION OF LIABILITY
|
| 40 |
+
|
| 41 |
+
NEITHER PARTY SHALL BE LIABLE TO THE OTHER FOR ANY INDIRECT, INCIDENTAL, CONSEQUENTIAL, SPECIAL, OR PUNITIVE DAMAGES. EACH PARTY'S TOTAL LIABILITY UNDER THIS AGREEMENT SHALL NOT EXCEED THE TOTAL FEES PAID OR PAYABLE BY CLIENT TO SERVICE PROVIDER IN THE THREE (3) MONTHS IMMEDIATELY PRECEDING THE EVENT GIVING RISE TO THE CLAIM.
|
| 42 |
+
|
| 43 |
+
10. GOVERNING LAW
|
| 44 |
+
|
| 45 |
+
This Agreement shall be governed by the laws of the State of New York, without regard to conflict-of-laws principles. Disputes shall be submitted to binding arbitration in New York City under the rules of the American Arbitration Association.
|
| 46 |
+
|
| 47 |
+
[Note: This agreement contains termination for cause provisions only. There is no termination for convenience clause — neither party may terminate this agreement without cause during the initial term.]
|
| 48 |
+
|
| 49 |
+
IN WITNESS WHEREOF, the Parties have executed this Agreement as of the Effective Date.
|
| 50 |
+
|
| 51 |
+
APEX CONSULTING GROUP, INC. MERIDIAN ENTERPRISES, LLC
|
| 52 |
+
By: ____________________ By: ____________________
|
| 53 |
+
Name: Amanda J. Whitfield Name: Carlos Reyes
|
| 54 |
+
Title: Managing Partner Title: Chief Operating Officer
|
software_license.txt
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
SOFTWARE LICENSE AGREEMENT
|
| 2 |
+
|
| 3 |
+
This Software License Agreement ("Agreement") is entered into as of January 1, 2024 ("Effective Date"), by and between TechVision Inc., a Delaware corporation with its principal offices at 100 Innovation Drive, San Jose, California 94105 ("Licensor"), and GlobalCorp Ltd., a corporation organized under the laws of England and Wales, with its registered office at 25 King Street, London EC2V 8AU ("Licensee").
|
| 4 |
+
|
| 5 |
+
1. GRANT OF LICENSE
|
| 6 |
+
|
| 7 |
+
Subject to the terms and conditions of this Agreement, Licensor hereby grants to Licensee a non-exclusive, non-transferable, non-sublicensable license to install and use the software product known as "VisionSuite Pro" (the "Software"), solely for Licensee's internal business operations. Licensee shall not distribute, sell, resell, or make the Software available to any third party.
|
| 8 |
+
|
| 9 |
+
2. INTELLECTUAL PROPERTY
|
| 10 |
+
|
| 11 |
+
All right, title, and interest in and to the Software, including all intellectual property rights therein, shall remain exclusively with Licensor. Nothing in this Agreement shall be construed to transfer any ownership rights to Licensee. Licensee shall promptly notify Licensor of any suspected infringement of Licensor's intellectual property rights.
|
| 12 |
+
|
| 13 |
+
3. LICENSE FEES
|
| 14 |
+
|
| 15 |
+
Licensee shall pay Licensor an annual license fee of Twenty-Five Thousand Dollars ($25,000), due and payable within thirty (30) days of the Effective Date and each anniversary thereof. Fees are non-refundable. Late payments shall bear interest at the rate of one and one-half percent (1.5%) per month.
|
| 16 |
+
|
| 17 |
+
4. TERM AND TERMINATION
|
| 18 |
+
|
| 19 |
+
This Agreement shall commence on the Effective Date and continue for an initial term of two (2) years, unless earlier terminated. Either party may terminate this Agreement for cause upon thirty (30) days' written notice if the other party materially breaches any provision hereof and fails to cure such breach within the notice period. Upon termination, Licensee shall immediately cease all use of the Software and certify destruction of all copies.
|
| 20 |
+
|
| 21 |
+
5. LIMITATION OF LIABILITY
|
| 22 |
+
|
| 23 |
+
IN NO EVENT SHALL LICENSOR BE LIABLE TO LICENSEE OR ANY THIRD PARTY FOR ANY INDIRECT, INCIDENTAL, SPECIAL, PUNITIVE, OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATED TO THIS AGREEMENT OR THE USE OF THE SOFTWARE, INCLUDING LOST PROFITS, LOSS OF DATA, OR BUSINESS INTERRUPTION, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
| 24 |
+
|
| 25 |
+
LICENSOR'S TOTAL CUMULATIVE LIABILITY ARISING OUT OF OR RELATED TO THIS AGREEMENT SHALL NOT EXCEED FIFTY THOUSAND DOLLARS ($50,000) OR THE TOTAL FEES PAID BY LICENSEE TO LICENSOR IN THE TWELVE (12) MONTHS IMMEDIATELY PRECEDING THE CLAIM, WHICHEVER IS LESSER.
|
| 26 |
+
|
| 27 |
+
6. WARRANTIES AND DISCLAIMERS
|
| 28 |
+
|
| 29 |
+
Licensor warrants that, for a period of ninety (90) days following the Effective Date, the Software will perform substantially in accordance with its accompanying documentation. EXCEPT FOR THE FOREGOING LIMITED WARRANTY, THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED.
|
| 30 |
+
|
| 31 |
+
7. CONFIDENTIALITY
|
| 32 |
+
|
| 33 |
+
Each party agrees to maintain the confidentiality of the other party's proprietary information and not to disclose such information to any third party without prior written consent. This obligation shall survive termination of this Agreement for a period of three (3) years.
|
| 34 |
+
|
| 35 |
+
8. GOVERNING LAW
|
| 36 |
+
|
| 37 |
+
This Agreement shall be governed by and construed in accordance with the laws of the State of California, without regard to its conflict-of-laws provisions. Any disputes shall be resolved in the state or federal courts located in Santa Clara County, California.
|
| 38 |
+
|
| 39 |
+
IN WITNESS WHEREOF, the parties have executed this Agreement as of the Effective Date.
|
| 40 |
+
|
| 41 |
+
TECHVISION INC. GLOBALCORP LTD.
|
| 42 |
+
By: ____________________ By: ____________________
|
| 43 |
+
Name: Sarah Chen Name: James Harrington
|
| 44 |
+
Title: Chief Executive Officer Title: Managing Director
|