Spaces:
Sleeping
Sleeping
Toan2004-ai commited on
Commit ·
d4e9165
1
Parent(s): e2236a4
add readme config
Browse files
app.py
CHANGED
|
@@ -10,11 +10,14 @@ def parse_energy_plan(text_input):
|
|
| 10 |
try:
|
| 11 |
final_input = text_input
|
| 12 |
try:
|
| 13 |
-
|
|
|
|
| 14 |
if isinstance(parsed_json, dict) and "instances" in parsed_json:
|
| 15 |
final_input = parsed_json["instances"][0].get("raw_text", text_input)
|
|
|
|
|
|
|
| 16 |
except json.JSONDecodeError:
|
| 17 |
-
|
| 18 |
|
| 19 |
result = final_process_eme_technical_guided(final_input)
|
| 20 |
|
|
|
|
| 10 |
try:
|
| 11 |
final_input = text_input
|
| 12 |
try:
|
| 13 |
+
clean_input = text_input.replace("None", "null").replace("True", "true").replace("False", "false")
|
| 14 |
+
parsed_json = json.loads(clean_input)
|
| 15 |
if isinstance(parsed_json, dict) and "instances" in parsed_json:
|
| 16 |
final_input = parsed_json["instances"][0].get("raw_text", text_input)
|
| 17 |
+
else:
|
| 18 |
+
final_input = json.dumps(parsed_json) # ← quan trọng
|
| 19 |
except json.JSONDecodeError:
|
| 20 |
+
final_input = text_input
|
| 21 |
|
| 22 |
result = final_process_eme_technical_guided(final_input)
|
| 23 |
|