Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from pptx import Presentation
|
| 3 |
-
from pptx.util import Inches
|
| 4 |
import io
|
| 5 |
from huggingface_hub import InferenceClient
|
| 6 |
import json
|
|
@@ -70,7 +70,7 @@ def generate_presentation_content(topic, client, max_retries=3):
|
|
| 70 |
def create_powerpoint(slides, template_path):
|
| 71 |
prs = Presentation(template_path)
|
| 72 |
|
| 73 |
-
#
|
| 74 |
for slide_data in slides:
|
| 75 |
slide = prs.slides.add_slide(prs.slide_layouts[1])
|
| 76 |
|
|
@@ -92,15 +92,6 @@ def create_powerpoint(slides, template_path):
|
|
| 92 |
tf = txBox.text_frame
|
| 93 |
tf.text = slide_data['content']
|
| 94 |
|
| 95 |
-
# Eliminar la primera diapositiva en blanco
|
| 96 |
-
if len(prs.slides) > 0:
|
| 97 |
-
slides_to_remove = prs.slides[0]
|
| 98 |
-
xml_slides = prs.slides._sldIdLst
|
| 99 |
-
slides_id = [sldId for sldId in xml_slides if sldId != slides_to_remove._element]
|
| 100 |
-
xml_slides.clear_content()
|
| 101 |
-
for slide_id in slides_id:
|
| 102 |
-
xml_slides.append(slide_id)
|
| 103 |
-
|
| 104 |
# Agregar una diapositiva final con "Gracias"
|
| 105 |
slide = prs.slides.add_slide(prs.slide_layouts[1])
|
| 106 |
title_shape = slide.shapes.title
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from pptx import Presentation
|
| 3 |
+
from pptx.util import Inches, Pt
|
| 4 |
import io
|
| 5 |
from huggingface_hub import InferenceClient
|
| 6 |
import json
|
|
|
|
| 70 |
def create_powerpoint(slides, template_path):
|
| 71 |
prs = Presentation(template_path)
|
| 72 |
|
| 73 |
+
# Agregar diapositivas generadas
|
| 74 |
for slide_data in slides:
|
| 75 |
slide = prs.slides.add_slide(prs.slide_layouts[1])
|
| 76 |
|
|
|
|
| 92 |
tf = txBox.text_frame
|
| 93 |
tf.text = slide_data['content']
|
| 94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
# Agregar una diapositiva final con "Gracias"
|
| 96 |
slide = prs.slides.add_slide(prs.slide_layouts[1])
|
| 97 |
title_shape = slide.shapes.title
|