Javier-Jimenez99 commited on
Commit
2c2836c
·
1 Parent(s): ad1dc01

Actualizar el procesamiento del README.md para manejar correctamente bloques de código HTML y mejorar la presentación en la interfaz.

Browse files
Files changed (2) hide show
  1. README.md +5 -2
  2. app.py +23 -2
README.md CHANGED
@@ -14,9 +14,12 @@ tags:
14
  # 🧙‍♂️ LLM Game Master Agent 🐉
15
 
16
  ## 🎥 Video Demo
 
 
17
  <iframe width="560" height="315" src="https://www.youtube.com/embed/SlbW-kjekBg?si=r6x8GeVnKLipriZL" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
 
18
 
19
- Video Demo: [https://www.youtube.com/watch?v=8b1k2g3Z4aY](https://www.youtube.com/watch?v=8b1k2g3Z4aY)
20
 
21
  ## 🧩 Complete Architecture Overview
22
  ![Architecture Overview](https://huggingface.co/spaces/Agents-MCP-Hackathon/LLM-GameMaster-Agent/resolve/main/media/architecture.png)
@@ -24,7 +27,7 @@ Video Demo: [https://www.youtube.com/watch?v=8b1k2g3Z4aY](https://www.youtube.co
24
  ## 🔗 Useful Links:
25
  - [Owlbear Rodeo Chat Interface](https://github.com/Agamador/OwlBear-llm-chat)
26
  - [MCP server](https://huggingface.co/spaces/Agents-MCP-Hackathon/LLM-GameMaster-MPC-Server)
27
- - [Video Demo](https://www.youtube.com/watch?v=8b1k2g3Z4aY)
28
 
29
  ## 🌟 Introduction
30
 
 
14
  # 🧙‍♂️ LLM Game Master Agent 🐉
15
 
16
  ## 🎥 Video Demo
17
+
18
+ ```html
19
  <iframe width="560" height="315" src="https://www.youtube.com/embed/SlbW-kjekBg?si=r6x8GeVnKLipriZL" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
20
+ ```
21
 
22
+ Video Demo: [https://www.youtube.com/watch?v=SlbW-kjekBg&ab_channel=AlejandroGarcíaAmador](https://www.youtube.com/watch?v=SlbW-kjekBg&ab_channel=AlejandroGarcíaAmador)
23
 
24
  ## 🧩 Complete Architecture Overview
25
  ![Architecture Overview](https://huggingface.co/spaces/Agents-MCP-Hackathon/LLM-GameMaster-Agent/resolve/main/media/architecture.png)
 
27
  ## 🔗 Useful Links:
28
  - [Owlbear Rodeo Chat Interface](https://github.com/Agamador/OwlBear-llm-chat)
29
  - [MCP server](https://huggingface.co/spaces/Agents-MCP-Hackathon/LLM-GameMaster-MPC-Server)
30
+ - [Video Demo](https://www.youtube.com/watch?v=SlbW-kjekBg&ab_channel=AlejandroGarcíaAmador)
31
 
32
  ## 🌟 Introduction
33
 
app.py CHANGED
@@ -361,9 +361,30 @@ with open("README.md", "r", encoding="utf-8") as f:
361
  if len(parts) >= 3:
362
  readme = parts[2]
363
 
364
- # Crear un bloque para contener el Markdown, en lugar de usar Markdown directamente
 
 
 
 
 
 
 
 
 
365
  with gr.Blocks() as intro_demo:
366
- gr.Markdown(readme)
 
 
 
 
 
 
 
 
 
 
 
 
367
 
368
  # Combined interface with tabs
369
  combined_demo = gr.TabbedInterface(
 
361
  if len(parts) >= 3:
362
  readme = parts[2]
363
 
364
+ # Procesar el README para manejar correctamente bloques de código HTML
365
+ import re
366
+
367
+ # Encontrar bloques de código HTML (```html ... ```)
368
+ html_blocks = re.findall(r'```html\n(.*?)\n```', readme, re.DOTALL)
369
+ # Reemplazar los bloques de código HTML por marcadores temporales
370
+ for i, html_block in enumerate(html_blocks):
371
+ readme = readme.replace(f"```html\n{html_block}\n```", f"{{HTML_BLOCK_{i}}}")
372
+
373
+ # Crear un bloque para contener el Markdown y HTML
374
  with gr.Blocks() as intro_demo:
375
+ # Dividir el contenido por los marcadores de HTML
376
+ parts = re.split(r'({HTML_BLOCK_\d+})', readme)
377
+
378
+ for part in parts:
379
+ if part.startswith("{HTML_BLOCK_"):
380
+ # Extraer el índice del bloque HTML
381
+ block_idx = int(part.replace("{HTML_BLOCK_", "").replace("}", ""))
382
+ # Renderizar el HTML directamente
383
+ gr.HTML(html_blocks[block_idx])
384
+ else:
385
+ # Renderizar el contenido Markdown
386
+ if part.strip():
387
+ gr.Markdown(part)
388
 
389
  # Combined interface with tabs
390
  combined_demo = gr.TabbedInterface(