DHEIVER commited on
Commit
a5c9e9a
·
verified ·
1 Parent(s): d9cfe61

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -5
app.py CHANGED
@@ -129,22 +129,18 @@ def extract_petition_details(petition_text):
129
  "remedies": "Não especificado"
130
  }
131
 
132
- # Extrair reclamante (simples regex para encontrar "por seu advogado")
133
  plaintiff_match = re.search(r"(.+?), por seu advogado", petition_text, re.IGNORECASE)
134
  if plaintiff_match:
135
  details["plaintiff"] = plaintiff_match.group(1).strip()
136
 
137
- # Extrair reivindicações (buscar por "pelos fatos a seguir" ou similar)
138
  claims_match = re.search(r"(?:pelos fatos a seguir|fundamentos.*?)(.+?)(?:requer|pedidos)", petition_text, re.IGNORECASE | re.DOTALL)
139
  if claims_match:
140
  details["claims"] = claims_match.group(1).strip()[:200] + "..." if len(claims_match.group(1)) > 200 else claims_match.group(1).strip()
141
 
142
- # Extrair base legal (buscar por "art." ou "lei")
143
  legal_basis_match = re.search(r"(art\..*?|lei.*?)(?:\n|$)", petition_text, re.IGNORECASE)
144
  if legal_basis_match:
145
  details["legal_basis"] = legal_basis_match.group(1).strip()
146
 
147
- # Extrair pedidos (buscar por "requer" ou "pede")
148
  remedies_match = re.search(r"(?:requer|pede)(.+)", petition_text, re.IGNORECASE | re.DOTALL)
149
  if remedies_match:
150
  details["remedies"] = remedies_match.group(1).strip()[:200] + "..." if len(remedies_match.group(1)) > 200 else remedies_match.group(1).strip()
@@ -266,7 +262,7 @@ with gr.Blocks(css=css) as iface:
266
  gr.Markdown("# Gerador de Contestação Jurídica")
267
  gr.Markdown("Faça upload de um arquivo PDF com a petição inicial para gerar uma contestação jurídica detalhada em HTML, um resumo em tabela e um PDF para download.")
268
 
269
- pdf_input = gr.File(label="Upload do PDF da Petição Inicial")
270
  contestacao_output = gr.HTML(label="Contestação Gerada")
271
  dataframe_output = gr.HTML(label="Resumo da Petição e Contestação")
272
  pdf_output = gr.File(label="Baixar Contestação em PDF", visible=False)
 
129
  "remedies": "Não especificado"
130
  }
131
 
 
132
  plaintiff_match = re.search(r"(.+?), por seu advogado", petition_text, re.IGNORECASE)
133
  if plaintiff_match:
134
  details["plaintiff"] = plaintiff_match.group(1).strip()
135
 
 
136
  claims_match = re.search(r"(?:pelos fatos a seguir|fundamentos.*?)(.+?)(?:requer|pedidos)", petition_text, re.IGNORECASE | re.DOTALL)
137
  if claims_match:
138
  details["claims"] = claims_match.group(1).strip()[:200] + "..." if len(claims_match.group(1)) > 200 else claims_match.group(1).strip()
139
 
 
140
  legal_basis_match = re.search(r"(art\..*?|lei.*?)(?:\n|$)", petition_text, re.IGNORECASE)
141
  if legal_basis_match:
142
  details["legal_basis"] = legal_basis_match.group(1).strip()
143
 
 
144
  remedies_match = re.search(r"(?:requer|pede)(.+)", petition_text, re.IGNORECASE | re.DOTALL)
145
  if remedies_match:
146
  details["remedies"] = remedies_match.group(1).strip()[:200] + "..." if len(remedies_match.group(1)) > 200 else remedies_match.group(1).strip()
 
262
  gr.Markdown("# Gerador de Contestação Jurídica")
263
  gr.Markdown("Faça upload de um arquivo PDF com a petição inicial para gerar uma contestação jurídica detalhada em HTML, um resumo em tabela e um PDF para download.")
264
 
265
+ pdf_input = gr.UploadButton(label="Upload do PDF da Petição Inicial", file_types=[".pdf"])
266
  contestacao_output = gr.HTML(label="Contestação Gerada")
267
  dataframe_output = gr.HTML(label="Resumo da Petição e Contestação")
268
  pdf_output = gr.File(label="Baixar Contestação em PDF", visible=False)