awacke1 commited on
Commit
6d154df
Β·
verified Β·
1 Parent(s): e59ea3f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +294 -1
README.md CHANGED
@@ -199,4 +199,297 @@ This updated code reflects your requirements by:
199
  Changing the graph to "Knowledge Graph".
200
  Displaying each situation once in the graph, with attempts as child nodes.
201
  Matching the Journey Preview format you provided.
202
- Providing a clear visualization of the player's journey with multiple trees for unique situations.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  Changing the graph to "Knowledge Graph".
200
  Displaying each situation once in the graph, with attempts as child nodes.
201
  Matching the Journey Preview format you provided.
202
+ Providing a clear visualization of the player's journey with multiple trees for unique situations.
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+ ---
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+ Example of AIPP:
245
+
246
+
247
+ Journey Preview aggregates the history correctly. Your Journey does not. I want the creation of the knowledge graph to be much more detail with every action and outcome shown in the graph. Currently it will only show the first one. Use this as a test case which should create 5 different nodes each showing the full story and then use connectors to join them all to eachother as a mind map. 🌳 Journey Preview
248
+ πŸ’€ ('The Eternal Catnap',)
249
+ Attempt 2: πŸƒ Showcase Agility: ❌ Failure You tripped over your own paws! 🐾 Attempt 3: πŸƒ Showcase Agility: ❌ Failure The enemy was too clever for your plan. 🧠 Attempt 3: πŸͺ„ Create a Distraction: βœ… Success ⭐ Victory is sweet, just like a bowl of fresh milk! πŸ₯› For the demo - I want a graph very similar to Markdown Node demo below: import streamlit as st
250
+ from streamlit_flow import streamlit_flow
251
+ from streamlit_flow.elements import StreamlitFlowNode, StreamlitFlowEdge
252
+ from streamlit_flow.layouts import RadialLayout
253
+
254
+
255
+ st.set_page_config(page_title="Markdown Node - Streamlit Flow", layout="wide")
256
+
257
+ st.title("Markdown Node Demo")
258
+ st.markdown("""The `StreamlitFlowNode` takes as input `content` within its `data` attribute which can either be plaintext, markdown or HTML.
259
+ This can be made to show a variety of content within the node. Below is an example of a node with markdown content.""")
260
+
261
+ nodes = [StreamlitFlowNode("main", (0, 0), {'content':"# Markdown Support in Nodes"}, 'input', 'bottom', width=400),
262
+ StreamlitFlowNode("text", (0, 0), {'content':
263
+ """### Text
264
+ Can support markdown text styles: **bold**, *italic* and `code`"""}, 'output', 'bottom', 'top'),
265
+
266
+ StreamlitFlowNode("code", (0, 0), {'content':
267
+ """### Code Block
268
+ ```python
269
+ print('Hello World')
270
+ ```"""},'output', 'bottom', 'top'),
271
+
272
+ StreamlitFlowNode("list", (0, 0), {'content':
273
+ """### List
274
+ 1. Ordered
275
+ 2. And
276
+ - Unordered
277
+ - Lists
278
+ """}, 'output', 'bottom', 'top'),
279
+
280
+ StreamlitFlowNode("math", (0, 0), {'content':
281
+ """### Math
282
+ $\\sum_{i=1}^{n} i = \\frac{n(n+1)}{2}$
283
+ """}, 'output', 'bottom', 'top'),
284
+
285
+ StreamlitFlowNode("github", (0, 0), {'content': '## Github Flavor Support'}, 'default', 'top', 'bottom'),
286
+
287
+ StreamlitFlowNode("strikethrough", (0, 0), {'content':
288
+ """
289
+ ### ~Strike through~
290
+ """}, 'output', 'bottom', 'top'),
291
+
292
+ StreamlitFlowNode("table", (0, 0), {'content':
293
+ """### Table
294
+
295
+ | a | b | c | d |
296
+ | - | :- | -: | :-: |
297
+ | 1 | 2 | 3 | 4 |
298
+ | 5 | 6 | 7 | 8 |
299
+
300
+ """}, 'output', 'top', 'right', width=160),
301
+
302
+ StreamlitFlowNode("tasks", (0, 0), {'content':
303
+ """## Tasklist
304
+
305
+ * [ ] to do
306
+ * [x] done
307
+ """}, 'output', 'top', 'bottom'),
308
+
309
+ StreamlitFlowNode("html", (0, 0), {'content':
310
+ """## Raw HTML"""}, 'default', 'top', 'bottom', width=200),
311
+
312
+ StreamlitFlowNode("link", (0, 0), {'content':
313
+ """### Link
314
+ <a href="https://github.com/dkapur17/streamlit-flow" target="_blank">Streamlit Flow</a>"""}, 'output', 'top', 'bottom'),
315
+
316
+ StreamlitFlowNode("expander", (0, 0), {'content':
317
+ """### Expander
318
+ <details>
319
+ <summary>Click to expand</summary>
320
+
321
+ This is hidden content
322
+ </details>
323
+ """}, 'output', 'top', 'bottom'),
324
+
325
+ StreamlitFlowNode("image",(0, 0), {'content':
326
+ """### Image
327
+ <img src="https://raw.githubusercontent.com/dkapur17/streamlit-flow/master/assets/streamlit-flow-logo.svg" alt="Streamlit Flow Logo" width="100">
328
+ """}, 'output', 'top', 'bottom', width=120),
329
+
330
+ StreamlitFlowNode("video", (0, 0), {'content':
331
+ """### Video
332
+ <video width="256" controls>
333
+ <source src="https://github.com/dkapur17/streamlit-flow/raw/master/assets/FastBuild.mp4" type="video/mp4">
334
+ </video>
335
+
336
+ """}, 'output', 'bottom', 'top', width=300)]
337
+
338
+ edges = [StreamlitFlowEdge("main-text", "main", "text", animated=True),
339
+ StreamlitFlowEdge("main-code", "main", "code", animated=True),
340
+ StreamlitFlowEdge("main-list", "main", "list", animated=True),
341
+ StreamlitFlowEdge("main-math", "main", "math", animated=True),
342
+ StreamlitFlowEdge("main-github", "main", "github", animated=True),
343
+ StreamlitFlowEdge("github-strikethrough", "github", "strikethrough", animated=True),
344
+ StreamlitFlowEdge("github-table", "github", "table", animated=True),
345
+ StreamlitFlowEdge("github-tasks", "github", "tasks", animated=True),
346
+ StreamlitFlowEdge("main-html", "main", "html", animated=True),
347
+ StreamlitFlowEdge("html-link", "html", "link", animated=True),
348
+ StreamlitFlowEdge("html-expander", "html", "expander", animated=True),
349
+ StreamlitFlowEdge("html-image", "html", "image", animated=True),
350
+ StreamlitFlowEdge("html-video", "html", "video", animated=True)]
351
+
352
+ streamlit_flow('markdown_node_flow', nodes, edges, layout=RadialLayout(), fit_view=True, height=1000)
353
+
354
+
355
+ st.divider()
356
+
357
+ with st.expander("Spolier"):
358
+ st.code("""
359
+ from streamlit_flow import streamlit_flow
360
+ from streamlit_flow.elements import StreamlitFlowNode, StreamlitFlowEdge
361
+ from streamlit_flow.layouts import RadialLayout
362
+
363
+ nodes = [StreamlitFlowNode("main", (0, 0), {'content':"# Markdown Support in Nodes"}, 'input', 'bottom', width=400),
364
+ StreamlitFlowNode("text", (0, 0), {'content':
365
+ \"""### Text
366
+ Can support markdown text styles: **bold**, *italic* and `code`\"""}, 'output', 'bottom', 'top'),
367
+
368
+ StreamlitFlowNode("code", (0, 0), {'content':
369
+ \"""### Code Block
370
+ ```python
371
+ print('Hello World')
372
+ ```\"""},'output', 'bottom', 'top'),
373
+
374
+ StreamlitFlowNode("list", (0, 0), {'content':
375
+ \"""### List
376
+ 1. Ordered
377
+ 2. And
378
+ - Unordered
379
+ - Lists
380
+ \"""}, 'output', 'bottom', 'top'),
381
+
382
+ StreamlitFlowNode("math", (0, 0), {'content':
383
+ \"""### Math
384
+ $\\sum_{i=1}^{n} i = \\frac{n(n+1)}{2}$
385
+ \"""}, 'output', 'bottom', 'top'),
386
+
387
+ StreamlitFlowNode("github", (0, 0), {'content': '## Github Flavor Support'}, 'default', 'top', 'bottom'),
388
+
389
+ StreamlitFlowNode("strikethrough", (0, 0), {'content':
390
+ \"""
391
+ ### ~Strike through~
392
+ \"""}, 'output', 'bottom', 'top'),
393
+
394
+ StreamlitFlowNode("table", (0, 0), {'content':
395
+ \"""### Table
396
+
397
+ | a | b | c | d |
398
+ | - | :- | -: | :-: |
399
+ | 1 | 2 | 3 | 4 |
400
+ | 5 | 6 | 7 | 8 |
401
+
402
+ \"""}, 'output', 'top', 'right', width=160),
403
+
404
+ StreamlitFlowNode("tasks", (0, 0), {'content':
405
+ \"""## Tasklist
406
+
407
+ * [ ] to do
408
+ * [x] done
409
+ \"""}, 'output', 'top', 'bottom'),
410
+
411
+ StreamlitFlowNode("html", (0, 0), {'content':
412
+ \"""## Raw HTML\"""}, 'default', 'top', 'bottom', width=200),
413
+
414
+ StreamlitFlowNode("link", (0, 0), {'content':
415
+ \"""### Link
416
+ <a href="https://github.com/dkapur17/streamlit-flow" target="_blank">Streamlit Flow</a>\"""}, 'output', 'top', 'bottom'),
417
+
418
+ StreamlitFlowNode("expander", (0, 0), {'content':
419
+ \"""### Expander
420
+ <details>
421
+ <summary>Click to expand</summary>
422
+
423
+ This is hidden content
424
+ </details>
425
+ \"""}, 'output', 'top', 'bottom'),
426
+
427
+ StreamlitFlowNode("image",(0, 0), {'content':
428
+ \"""### Image
429
+ <img src="https://raw.githubusercontent.com/dkapur17/streamlit-flow/master/assets/streamlit-flow-logo.svg" alt="Streamlit Flow Logo" width="100">
430
+ \"""}, 'output', 'top', 'bottom', width=120),
431
+
432
+ StreamlitFlowNode("video", (0, 0), {'content':
433
+ \"""### Video
434
+ <video width="256" controls>
435
+ <source src="https://github.com/dkapur17/streamlit-flow/raw/master/assets/FastBuild.mp4" type="video/mp4">
436
+ </video>
437
+
438
+ \"""}, 'output', 'bottom', 'top', width=300)]
439
+
440
+ edges = [StreamlitFlowEdge("main-text", "main", "text", animated=True),
441
+ StreamlitFlowEdge("main-code", "main", "code", animated=True),
442
+ StreamlitFlowEdge("main-list", "main", "list", animated=True),
443
+ StreamlitFlowEdge("main-math", "main", "math", animated=True),
444
+ StreamlitFlowEdge("main-github", "main", "github", animated=True),
445
+ StreamlitFlowEdge("github-strikethrough", "github", "strikethrough", animated=True),
446
+ StreamlitFlowEdge("github-table", "github", "table", animated=True),
447
+ StreamlitFlowEdge("github-tasks", "github", "tasks", animated=True),
448
+ StreamlitFlowEdge("main-html", "main", "html", animated=True),
449
+ StreamlitFlowEdge("html-link", "html", "link", animated=True),
450
+ StreamlitFlowEdge("html-expander", "html", "expander", animated=True),
451
+ StreamlitFlowEdge("html-image", "html", "image", animated=True),
452
+ StreamlitFlowEdge("html-video", "html", "video", animated=True)]
453
+
454
+
455
+ streamlit_flow('example_flow',
456
+ nodes,
457
+ edges,
458
+ layout=RadialLayout(),
459
+ fit_view=True,
460
+ height=1000)
461
+ """) Also add this atop of the code so I can always be in wide mode. # 1. Configuration
462
+ Site_Name = '🦁CatRider🐈'
463
+ title="🦁CatRider🐈byπŸ‘€Aaron Wacker"
464
+ helpURL='https://huggingface.co/awacke1'
465
+ bugURL='https://huggingface.co/spaces/awacke1'
466
+ icons='🦁'
467
+
468
+ useConfig=True
469
+ if useConfig: # Component code - useConfig=False should allow it to work if re-evaluating UI elements due to code modify
470
+ st.set_page_config(
471
+ page_title=title,
472
+ page_icon=icons,
473
+ layout="wide",
474
+ #initial_sidebar_state="expanded",
475
+ initial_sidebar_state="auto",
476
+ menu_items={
477
+ 'Get Help': helpURL,
478
+ 'Report a bug': bugURL,
479
+ 'About': title
480
+ }
481
+ )
482
+
483
+ πŸ‘‘ ('The Royal Tournament',)
484
+ Attempt 2: πŸƒβ€β™€οΈ Sprint Away: ❌ Failure The cat gods were not in your favor today. πŸ™€ Attempt 2: 🦁 Show Bravery: βœ… Success ⭐⭐ You’ve earned the title of Cat Commander! πŸ… Attempt 2: 🧠 Be Resourceful: ❌ Failure The challenge was too great this time. Better luck next time! πŸ€
485
+
486
+ πŸ‘½ ('The Feline Invasion',)
487
+ Attempt 1: πŸƒ Showcase Agility: βœ… Success ⭐⭐⭐ You’ve earned the title of Cat Commander! πŸ…
488
+
489
+ πŸŒ• ('The Feline Moon Mission',)
490
+ Attempt 1: 🧠 Be Resourceful: βœ… Success ⭐⭐⭐⭐ Your strategy was flawless, and the victory is yours! πŸŽ–οΈ
491
+
492
+ πŸšͺ ('The Great Feline Escape',)
493
+ Attempt 1: 🧠 Be Resourceful: βœ… Success ⭐⭐⭐⭐⭐ All the other cats are jealous of your agility! πŸƒβ€β™‚οΈ
494
+
495
+ 🌳 Your Journey (Knowledge Graph)