Spaces:
Paused
Paused
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -115,12 +115,17 @@ def respond(msg, history):
|
|
| 115 |
if is_glyph:
|
| 116 |
keys = [BY_GLYPH[c][0] for c in msg] if all(c in BY_GLYPH for c in msg) else intent(msg)
|
| 117 |
if keys:
|
| 118 |
-
|
|
|
|
| 119 |
code = to_code(keys)
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
f"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
return chat(history or [], msg) # otherwise, just converse
|
| 125 |
|
| 126 |
|
|
|
|
| 115 |
if is_glyph:
|
| 116 |
keys = [BY_GLYPH[c][0] for c in msg] if all(c in BY_GLYPH for c in msg) else intent(msg)
|
| 117 |
if keys:
|
| 118 |
+
al = lambda g: chr(0x1400 + (ord(g) - 0x4e00)) # alien display glyph
|
| 119 |
+
glyphs = "".join(al(BY_KEY[k][1]) for k in keys)
|
| 120 |
code = to_code(keys)
|
| 121 |
+
steps = "\n".join(f"{i+1}. *{BY_KEY[k][3]}* β {al(BY_KEY[k][1])} β `{BY_KEY[k][2]}`"
|
| 122 |
+
for i, k in enumerate(keys))
|
| 123 |
+
return (f"**π§ Reasoning β I break the request into operations, encode each as one "
|
| 124 |
+
f"glyph, and compose the code:**\n{steps}\n\n"
|
| 125 |
+
f"**Message the agents actually send:** {glyphs} β "
|
| 126 |
+
f"**{len(keys) * 2} bytes** vs {len(msg)} in English "
|
| 127 |
+
f"({round((1 - len(keys)*2/max(len(msg),1))*100)}% smaller)\n\n"
|
| 128 |
+
f"```python\n{code}\n```\n\nRunning it: `solve({DEMO})` β `{run(code)}`")
|
| 129 |
return chat(history or [], msg) # otherwise, just converse
|
| 130 |
|
| 131 |
|