Spaces:
Sleeping
Sleeping
Update ui/contentagentui.py
Browse files- ui/contentagentui.py +5 -0
ui/contentagentui.py
CHANGED
|
@@ -47,12 +47,16 @@ class ContentAgentUI:
|
|
| 47 |
return "Checking endpoint status…"
|
| 48 |
|
| 49 |
def _load_examples(self) -> list[str]:
|
|
|
|
|
|
|
| 50 |
ex_dir = os.path.join(os.path.dirname(__file__), "examples")
|
| 51 |
out: list[str] = []
|
| 52 |
if os.path.isdir(ex_dir):
|
| 53 |
for name in sorted(os.listdir(ex_dir)):
|
| 54 |
if name.lower().endswith(".txt"):
|
| 55 |
p = os.path.join(ex_dir, name)
|
|
|
|
|
|
|
| 56 |
try:
|
| 57 |
with open(p, "r", encoding="utf-8", errors="ignore") as f:
|
| 58 |
out.append(f.read())
|
|
@@ -71,6 +75,7 @@ class ContentAgentUI:
|
|
| 71 |
except Exception as e:
|
| 72 |
return f"Error: {e}"
|
| 73 |
|
|
|
|
| 74 |
# ---------- UI build ----------
|
| 75 |
|
| 76 |
def build(self) -> gr.Blocks:
|
|
|
|
| 47 |
return "Checking endpoint status…"
|
| 48 |
|
| 49 |
def _load_examples(self) -> list[str]:
|
| 50 |
+
|
| 51 |
+
print("load examples")
|
| 52 |
ex_dir = os.path.join(os.path.dirname(__file__), "examples")
|
| 53 |
out: list[str] = []
|
| 54 |
if os.path.isdir(ex_dir):
|
| 55 |
for name in sorted(os.listdir(ex_dir)):
|
| 56 |
if name.lower().endswith(".txt"):
|
| 57 |
p = os.path.join(ex_dir, name)
|
| 58 |
+
|
| 59 |
+
print(p)
|
| 60 |
try:
|
| 61 |
with open(p, "r", encoding="utf-8", errors="ignore") as f:
|
| 62 |
out.append(f.read())
|
|
|
|
| 75 |
except Exception as e:
|
| 76 |
return f"Error: {e}"
|
| 77 |
|
| 78 |
+
|
| 79 |
# ---------- UI build ----------
|
| 80 |
|
| 81 |
def build(self) -> gr.Blocks:
|