Fix empty pagecontent in HF UI
Browse files
gradio_app/pages/paper2ppt.py
CHANGED
|
@@ -89,8 +89,12 @@ async def _run_pagecontent(
|
|
| 89 |
state.text_content = text
|
| 90 |
|
| 91 |
from dataflow_agent.workflow import run_workflow
|
| 92 |
-
final_state
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
return str(run_dir), json.dumps(pagecontent, ensure_ascii=False, indent=2)
|
| 95 |
|
| 96 |
|
|
|
|
| 89 |
state.text_content = text
|
| 90 |
|
| 91 |
from dataflow_agent.workflow import run_workflow
|
| 92 |
+
final_state = await run_workflow("paper2page_content", state)
|
| 93 |
+
# langgraph will return `dict` when the state schema is a dataclass.
|
| 94 |
+
if isinstance(final_state, dict):
|
| 95 |
+
pagecontent = final_state.get("pagecontent") or []
|
| 96 |
+
else:
|
| 97 |
+
pagecontent = getattr(final_state, "pagecontent", []) or []
|
| 98 |
return str(run_dir), json.dumps(pagecontent, ensure_ascii=False, indent=2)
|
| 99 |
|
| 100 |
|
gradio_app/pages/ppt2polish.py
CHANGED
|
@@ -89,8 +89,12 @@ async def _run_pagecontent_from_pptx(
|
|
| 89 |
state.paper_file = str(dst)
|
| 90 |
|
| 91 |
from dataflow_agent.workflow import run_workflow
|
| 92 |
-
final_state
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
return str(run_dir), json.dumps(pagecontent, ensure_ascii=False, indent=2)
|
| 95 |
|
| 96 |
|
|
|
|
| 89 |
state.paper_file = str(dst)
|
| 90 |
|
| 91 |
from dataflow_agent.workflow import run_workflow
|
| 92 |
+
final_state = await run_workflow("paper2page_content", state)
|
| 93 |
+
# langgraph will return `dict` when the state schema is a dataclass.
|
| 94 |
+
if isinstance(final_state, dict):
|
| 95 |
+
pagecontent = final_state.get("pagecontent") or []
|
| 96 |
+
else:
|
| 97 |
+
pagecontent = getattr(final_state, "pagecontent", []) or []
|
| 98 |
return str(run_dir), json.dumps(pagecontent, ensure_ascii=False, indent=2)
|
| 99 |
|
| 100 |
|