Spaces:
Sleeping
Sleeping
Update main_demo.py
Browse files- main_demo.py +22 -13
main_demo.py
CHANGED
|
@@ -1,13 +1,22 @@
|
|
| 1 |
-
from graph_pipeline import textdoctor_app, TextDoctorState
|
| 2 |
-
|
| 3 |
-
if __name__ == "__main__":
|
| 4 |
-
|
| 5 |
-
"
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from graph_pipeline import textdoctor_app, TextDoctorState
|
| 2 |
+
|
| 3 |
+
if __name__ == "__main__":
|
| 4 |
+
try:
|
| 5 |
+
print("=== TextDoctor CLI ===")
|
| 6 |
+
user_text = input("\nEnter your text: ").strip()
|
| 7 |
+
|
| 8 |
+
if not user_text:
|
| 9 |
+
print("❌ No text entered.")
|
| 10 |
+
exit()
|
| 11 |
+
|
| 12 |
+
state: TextDoctorState = {"input_text": user_text}
|
| 13 |
+
final_state = textdoctor_app.invoke(state)
|
| 14 |
+
|
| 15 |
+
print("\n--- Final Output ---")
|
| 16 |
+
print(final_state["review_result"]["final_text"])
|
| 17 |
+
|
| 18 |
+
print("\n--- Explanation ---")
|
| 19 |
+
print(final_state["review_result"]["decision_explanation"])
|
| 20 |
+
|
| 21 |
+
except Exception as e:
|
| 22 |
+
print("\n❌ An error occurred:", e)
|