Spaces:
Sleeping
Sleeping
Toan2004-ai commited on
Commit ·
d5dd651
1
Parent(s): 3876905
add readme config
Browse files
app.py
CHANGED
|
@@ -9,7 +9,7 @@ def parse_energy_plan(text_input):
|
|
| 9 |
from main import final_process_eme_technical_guided
|
| 10 |
|
| 11 |
if not text_input or not text_input.strip():
|
| 12 |
-
return json.dumps({"error": "
|
| 13 |
|
| 14 |
try:
|
| 15 |
try:
|
|
@@ -22,7 +22,7 @@ def parse_energy_plan(text_input):
|
|
| 22 |
except:
|
| 23 |
final_input = str(raw_payload)
|
| 24 |
else:
|
| 25 |
-
final_input =
|
| 26 |
except json.JSONDecodeError:
|
| 27 |
final_input = text_input
|
| 28 |
|
|
@@ -37,12 +37,12 @@ demo = gr.Interface(
|
|
| 37 |
fn=parse_energy_plan,
|
| 38 |
inputs=gr.Textbox(
|
| 39 |
label="Energy Plan Input",
|
| 40 |
-
placeholder="
|
| 41 |
lines=12
|
| 42 |
),
|
| 43 |
outputs=gr.Code(label="Extracted Schema", language="json"),
|
| 44 |
-
title="
|
| 45 |
-
description="
|
| 46 |
)
|
| 47 |
|
| 48 |
if __name__ == "__main__":
|
|
|
|
| 9 |
from main import final_process_eme_technical_guided
|
| 10 |
|
| 11 |
if not text_input or not text_input.strip():
|
| 12 |
+
return json.dumps({"error": "Input cannot be empty"}, indent=2)
|
| 13 |
|
| 14 |
try:
|
| 15 |
try:
|
|
|
|
| 22 |
except:
|
| 23 |
final_input = str(raw_payload)
|
| 24 |
else:
|
| 25 |
+
final_input = json.dumps(parsed_json)
|
| 26 |
except json.JSONDecodeError:
|
| 27 |
final_input = text_input
|
| 28 |
|
|
|
|
| 37 |
fn=parse_energy_plan,
|
| 38 |
inputs=gr.Textbox(
|
| 39 |
label="Energy Plan Input",
|
| 40 |
+
placeholder="Paste the energy plan JSON here...",
|
| 41 |
lines=12
|
| 42 |
),
|
| 43 |
outputs=gr.Code(label="Extracted Schema", language="json"),
|
| 44 |
+
title="Volta Energy Plan Parser",
|
| 45 |
+
description="Extract structured data from Australian energy plans."
|
| 46 |
)
|
| 47 |
|
| 48 |
if __name__ == "__main__":
|