Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -112,11 +112,7 @@ def text2ppt(token_key, input_prompt, input_theme):
|
|
112 |
f.write(data)
|
113 |
f.close()
|
114 |
|
115 |
-
subprocess.run(["./pandoc-2.14.2/bin/pandoc", "
|
116 |
-
print(os.listdir(os.getcwd()))
|
117 |
-
# subprocess.run(
|
118 |
-
# f"npx @marp-team/marp-cli@latest --pdf-fonts-dir=/usr/share/fonts/truetype/nanum --pdf-default-font=NanumGothic -o output.pdf text2ppt_test.md --chrome-path=/usr/bin/google-chrome-stable",
|
119 |
-
# shell=True)
|
120 |
|
121 |
|
122 |
def ppt2script(token_key, input_file, input_type):
|
@@ -134,7 +130,7 @@ def ppt2script(token_key, input_file, input_type):
|
|
134 |
text += "[PAGE_NUM " + str(page_num + 1) + "]"
|
135 |
text += page.extract_text()
|
136 |
else:
|
137 |
-
prs = Presentation(
|
138 |
|
139 |
text = ""
|
140 |
page_num = 0
|
@@ -215,7 +211,7 @@ with tab1:
|
|
215 |
st.download_button(label="Download PPT",
|
216 |
data = binary_output.getvalue(),
|
217 |
file_name="export_output.pptx",
|
218 |
-
mime='application/octet-stream', key = "<
|
219 |
|
220 |
with tab2:
|
221 |
st.header('Text2PPT')
|
@@ -254,13 +250,14 @@ with tab2:
|
|
254 |
if input_text_check == True:
|
255 |
with st.spinner('Wait for it...'):
|
256 |
text2ppt(gpt_token, generate_text2ppt_input_prompt(status, input_text, page_choice), thema_select)
|
257 |
-
|
258 |
-
|
|
|
259 |
st.success('Done!')
|
260 |
st.download_button(label="Download PPT",
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
|
265 |
with tab3:
|
266 |
st.header('PPT2Script')
|
|
|
112 |
f.write(data)
|
113 |
f.close()
|
114 |
|
115 |
+
subprocess.run(["./pandoc-2.14.2/bin/pandoc", "text2ppt_input.md", "-t", "pptx", "-o", "text2ppt_output.pptx"], capture_output=True)
|
|
|
|
|
|
|
|
|
116 |
|
117 |
|
118 |
def ppt2script(token_key, input_file, input_type):
|
|
|
130 |
text += "[PAGE_NUM " + str(page_num + 1) + "]"
|
131 |
text += page.extract_text()
|
132 |
else:
|
133 |
+
prs = Presentation(input_file)
|
134 |
|
135 |
text = ""
|
136 |
page_num = 0
|
|
|
211 |
st.download_button(label="Download PPT",
|
212 |
data = binary_output.getvalue(),
|
213 |
file_name="export_output.pptx",
|
214 |
+
mime='application/octet-stream', key = "<Text2PPT_test_download>")
|
215 |
|
216 |
with tab2:
|
217 |
st.header('Text2PPT')
|
|
|
250 |
if input_text_check == True:
|
251 |
with st.spinner('Wait for it...'):
|
252 |
text2ppt(gpt_token, generate_text2ppt_input_prompt(status, input_text, page_choice), thema_select)
|
253 |
+
prs = Presentation("text2ppt_output.pptx")
|
254 |
+
binary_output = BytesIO()
|
255 |
+
prs.save(binary_output)
|
256 |
st.success('Done!')
|
257 |
st.download_button(label="Download PPT",
|
258 |
+
data = binary_output.getvalue(),
|
259 |
+
file_name="export_output.pptx",
|
260 |
+
mime='application/octet-stream', key = "<Text2PPT_download>")
|
261 |
|
262 |
with tab3:
|
263 |
st.header('PPT2Script')
|