Update app.py
Browse files
app.py
CHANGED
|
@@ -4,8 +4,7 @@ env.env_set()
|
|
| 4 |
print(os.getcwd())
|
| 5 |
|
| 6 |
import streamlit as st
|
| 7 |
-
import PyPDF2
|
| 8 |
-
import openai
|
| 9 |
import subprocess
|
| 10 |
from io import BytesIO
|
| 11 |
from pptx import Presentation
|
|
@@ -49,7 +48,6 @@ with tab1:
|
|
| 49 |
|
| 50 |
with tab2:
|
| 51 |
st.header('Text2PPT')
|
| 52 |
-
gpt_token = st.text_input('Please enter your ChatGPT API token.', key="<Text2PPT_token>")
|
| 53 |
st.markdown('-------------------------')
|
| 54 |
|
| 55 |
st.subheader(':computer: PPT Auto Generator :computer:')
|
|
@@ -63,7 +61,7 @@ with tab2:
|
|
| 63 |
|
| 64 |
st.markdown('-------------------------')
|
| 65 |
|
| 66 |
-
page_choice = st.slider('Number of PPT pages', min_value=2, max_value=
|
| 67 |
|
| 68 |
st.markdown('-------------------------')
|
| 69 |
|
|
@@ -86,7 +84,7 @@ with tab2:
|
|
| 86 |
|
| 87 |
if input_text_check == True:
|
| 88 |
with st.spinner('Wait for it...'):
|
| 89 |
-
pa.text2ppt(
|
| 90 |
prs = Presentation("text2ppt_output.pptx")
|
| 91 |
binary_output = BytesIO()
|
| 92 |
prs.save(binary_output)
|
|
@@ -99,10 +97,9 @@ with tab2:
|
|
| 99 |
with tab3:
|
| 100 |
st.header('PPT2Script')
|
| 101 |
st.subheader(':computer: Script Auto Generator :computer:')
|
| 102 |
-
gpt_token = st.text_input('Please enter your ChatGPT API token.', key="<PPT2Script_token>")
|
| 103 |
st.markdown('-------------------------')
|
| 104 |
|
| 105 |
-
st.subheader(':
|
| 106 |
|
| 107 |
file_order = ['PDF', 'PPT']
|
| 108 |
choose = st.radio('Please select the file format of the presentation material', file_order)
|
|
@@ -120,7 +117,7 @@ with tab3:
|
|
| 120 |
with open(uploaded_file.name, mode='wb') as w:
|
| 121 |
w.write(uploaded_file.getvalue())
|
| 122 |
|
| 123 |
-
script = pa.ppt2script(
|
| 124 |
|
| 125 |
st.success('Done!')
|
| 126 |
st.download_button('Download Script',
|
|
|
|
| 4 |
print(os.getcwd())
|
| 5 |
|
| 6 |
import streamlit as st
|
| 7 |
+
import PyPDF2]
|
|
|
|
| 8 |
import subprocess
|
| 9 |
from io import BytesIO
|
| 10 |
from pptx import Presentation
|
|
|
|
| 48 |
|
| 49 |
with tab2:
|
| 50 |
st.header('Text2PPT')
|
|
|
|
| 51 |
st.markdown('-------------------------')
|
| 52 |
|
| 53 |
st.subheader(':computer: PPT Auto Generator :computer:')
|
|
|
|
| 61 |
|
| 62 |
st.markdown('-------------------------')
|
| 63 |
|
| 64 |
+
page_choice = st.slider('Number of PPT pages', min_value=2, max_value=12, step=1, value=5)
|
| 65 |
|
| 66 |
st.markdown('-------------------------')
|
| 67 |
|
|
|
|
| 84 |
|
| 85 |
if input_text_check == True:
|
| 86 |
with st.spinner('Wait for it...'):
|
| 87 |
+
pa.text2ppt(pa.generate_text2ppt_input_prompt(status, input_text, page_choice), thema_select)
|
| 88 |
prs = Presentation("text2ppt_output.pptx")
|
| 89 |
binary_output = BytesIO()
|
| 90 |
prs.save(binary_output)
|
|
|
|
| 97 |
with tab3:
|
| 98 |
st.header('PPT2Script')
|
| 99 |
st.subheader(':computer: Script Auto Generator :computer:')
|
|
|
|
| 100 |
st.markdown('-------------------------')
|
| 101 |
|
| 102 |
+
st.subheader(':bookmark: Presentation Script Generator')
|
| 103 |
|
| 104 |
file_order = ['PDF', 'PPT']
|
| 105 |
choose = st.radio('Please select the file format of the presentation material', file_order)
|
|
|
|
| 117 |
with open(uploaded_file.name, mode='wb') as w:
|
| 118 |
w.write(uploaded_file.getvalue())
|
| 119 |
|
| 120 |
+
script = pa.ppt2script(uploaded_file.name, choose)
|
| 121 |
|
| 122 |
st.success('Done!')
|
| 123 |
st.download_button('Download Script',
|