Update app.py
Browse filesfixing identation
app.py
CHANGED
|
@@ -70,12 +70,14 @@ def generate_text(prompt):
|
|
| 70 |
def process_chunk(text, template, current):
|
| 71 |
input_text = f"### Template:\n{template}\n### Current:\n{current}\n### Text:\n{text}\n"
|
| 72 |
output_text = generate_text(input_text)
|
|
|
|
| 73 |
try:
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
except json.JSONDecodeError as e:
|
| 77 |
-
|
| 78 |
-
|
|
|
|
| 79 |
|
| 80 |
def send_chunk_to_model(text, template, current):
|
| 81 |
"""Envia um chunk de texto para o modelo local e processa a saída."""
|
|
|
|
| 70 |
def process_chunk(text, template, current):
|
| 71 |
input_text = f"### Template:\n{template}\n### Current:\n{current}\n### Text:\n{text}\n"
|
| 72 |
output_text = generate_text(input_text)
|
| 73 |
+
|
| 74 |
try:
|
| 75 |
+
parsed_output = json.loads(output_text)
|
| 76 |
+
return json.dumps(parsed_output, indent=2, ensure_ascii=False)
|
| 77 |
+
except json.JSONDecodeError as e:
|
| 78 |
+
print("Erro ao decodificar JSON:", e)
|
| 79 |
+
return output_text
|
| 80 |
+
|
| 81 |
|
| 82 |
def send_chunk_to_model(text, template, current):
|
| 83 |
"""Envia um chunk de texto para o modelo local e processa a saída."""
|