Spaces:
Runtime error
Runtime error
Hyeonseo
commited on
Commit
โข
863ee52
0
Parent(s):
Duplicate from SRankChatGpt/Presentation-Assistant
Browse files- .gitattributes +35 -0
- README.md +14 -0
- app.py +127 -0
- pandoc-2.14.2/bin/pandoc +3 -0
- pandoc-2.14.2/share/man/man1/pandoc.1.gz +3 -0
- presentation_assistant/__init__.py +0 -0
- presentation_assistant/env_set.py +39 -0
- presentation_assistant/presentation_assistant.py +159 -0
- requirements.txt +2 -0
- template/blue.pptx +0 -0
- template/gradation_green.pptx +0 -0
- template/green.pptx +0 -0
- template/yellow.pptx +0 -0
- text2ppt_test.md +87 -0
.gitattributes
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
35 |
+
pandoc-2.14.2/bin/pandoc filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: PA(Presentation Assistant)
|
3 |
+
emoji: ๐งโ๐ซ
|
4 |
+
colorFrom: indigo
|
5 |
+
colorTo: green
|
6 |
+
sdk: streamlit
|
7 |
+
sdk_version: 1.17.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
license: apache-2.0
|
11 |
+
duplicated_from: SRankChatGpt/Presentation-Assistant
|
12 |
+
---
|
13 |
+
|
14 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import presentation_assistant.env_set as env
|
3 |
+
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
|
12 |
+
|
13 |
+
|
14 |
+
import presentation_assistant.presentation_assistant as pa
|
15 |
+
|
16 |
+
tab1, tab2, tab3 = st.tabs(['What is PA!?', 'Text2PPT', 'PPT2Script'])
|
17 |
+
|
18 |
+
with tab1:
|
19 |
+
st.header('Introduction')
|
20 |
+
st.title('PA!(Presentation Assistant):sparkles:')
|
21 |
+
contents = """
|
22 |
+
โถ Based on the content entered by the user, it :blue[automatically creates] PPT and
|
23 |
+
provides a presentation :red[script] to improve presentation skills!"""
|
24 |
+
st.markdown(contents)
|
25 |
+
st.markdown('-------------------------')
|
26 |
+
st.header('How to use')
|
27 |
+
st.subheader('Text2PPT')
|
28 |
+
contents = """
|
29 |
+
โถ If the user provides a link or file, we will :blue[create a presentation material] for you!
|
30 |
+
The user only needs to select the desired theme (template) type and number of pages!"""
|
31 |
+
st.markdown(contents)
|
32 |
+
st.subheader('PPT2Script')
|
33 |
+
contents = """
|
34 |
+
โถ If the user provides PPT or PDF presentation materials, we will automatically create a :blue[presentation script] for you!"""
|
35 |
+
st.markdown(contents)
|
36 |
+
|
37 |
+
# Test
|
38 |
+
# test_ppt_theme = "--reference-doc="+"/home/user/app/template/blue"+".pptx"
|
39 |
+
# subprocess.run(["/home/user/app/pandoc-2.14.2/bin/pandoc", "text2ppt_test.md", "-t", "pptx", test_ppt_theme, "-o", "output.pptx"], capture_output=True)
|
40 |
+
# print(os.listdir(os.getcwd()))
|
41 |
+
# prs = Presentation("output.pptx")
|
42 |
+
# binary_output = BytesIO()
|
43 |
+
# prs.save(binary_output)
|
44 |
+
# st.download_button(label="Download PPT",
|
45 |
+
# data = binary_output.getvalue(),
|
46 |
+
# file_name="export_output.pptx",
|
47 |
+
# mime='application/octet-stream', key = "<Text2PPT_test_download>")
|
48 |
+
|
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:')
|
56 |
+
|
57 |
+
thema_select = st.selectbox(
|
58 |
+
'Please select the template you want.',
|
59 |
+
['default', 'yellow', 'gradation_green', 'blue', 'green', 'custom'])
|
60 |
+
|
61 |
+
if thema_select == "custom":
|
62 |
+
uploaded_template_file = st.file_uploader('Choose File!', type='pptx', key="<template_uploader>")
|
63 |
+
|
64 |
+
st.markdown('-------------------------')
|
65 |
+
|
66 |
+
page_choice = st.slider('Number of PPT pages', min_value=2, max_value=10, step=1, value=5)
|
67 |
+
|
68 |
+
st.markdown('-------------------------')
|
69 |
+
|
70 |
+
my_order = ['Text', 'Link', 'PDF']
|
71 |
+
status = st.radio('Please select the file type and enter the content! :smile: ', my_order)
|
72 |
+
|
73 |
+
# First method
|
74 |
+
if status == my_order[0]:
|
75 |
+
input_text = st.text_area('Enter TEXT', height=5)
|
76 |
+
|
77 |
+
elif status == my_order[1]:
|
78 |
+
input_text = st.text_area('Enter URL', height=5)
|
79 |
+
|
80 |
+
elif status == my_order[2]:
|
81 |
+
input_text = st.file_uploader('Upload PDF', type=['pdf'])
|
82 |
+
|
83 |
+
input_text_check = st.button('Confirm', key="<Text2PPT_start>")
|
84 |
+
|
85 |
+
st.markdown('-------------------------')
|
86 |
+
|
87 |
+
if input_text_check == True:
|
88 |
+
with st.spinner('Wait for it...'):
|
89 |
+
pa.text2ppt(gpt_token, pa.generate_text2ppt_input_prompt(status, input_text, page_choice), thema_select)
|
90 |
+
prs = Presentation("text2ppt_output.pptx")
|
91 |
+
binary_output = BytesIO()
|
92 |
+
prs.save(binary_output)
|
93 |
+
st.success('Done!')
|
94 |
+
st.download_button(label="Download PPT",
|
95 |
+
data = binary_output.getvalue(),
|
96 |
+
file_name="export_output.pptx",
|
97 |
+
mime='application/octet-stream', key = "<Text2PPT_download>")
|
98 |
+
|
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(':bookmark_tabs:Presentation Script Generator')
|
106 |
+
|
107 |
+
file_order = ['PDF', 'PPT']
|
108 |
+
choose = st.radio('Please select the file format of the presentation material', file_order)
|
109 |
+
|
110 |
+
if choose == file_order[0]:
|
111 |
+
uploaded_file = st.file_uploader('Choose File!', type='pdf', key="<PPT2Script_pdf_uploader>")
|
112 |
+
elif choose == file_order[1]:
|
113 |
+
uploaded_file = st.file_uploader('Choose File!', type='pptx', key="<PPT2Script_ppt_uploader>")
|
114 |
+
|
115 |
+
input_file_check = st.button('Confirm', key="<PPT2Script_start>") # When this button is pressed, the input file should be passed
|
116 |
+
st.markdown('-------------------------')
|
117 |
+
|
118 |
+
if input_file_check == True:
|
119 |
+
with st.spinner('Wait for it...'):
|
120 |
+
with open(uploaded_file.name, mode='wb') as w:
|
121 |
+
w.write(uploaded_file.getvalue())
|
122 |
+
|
123 |
+
script = pa.ppt2script(gpt_token, uploaded_file.name, choose)
|
124 |
+
|
125 |
+
st.success('Done!')
|
126 |
+
st.download_button('Download Script',
|
127 |
+
data=script, file_name="script_output.txt", key="<PPT2Script_download>")
|
pandoc-2.14.2/bin/pandoc
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1a2cb859c04eddd0f36e18dca1466d2957e9686bdbe113bc96e5476b59aa87af
|
3 |
+
size 76884208
|
pandoc-2.14.2/share/man/man1/pandoc.1.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:67bd56ab5fa90753f6af440b6cf29e39525f517c2d9a55183e3c7f89d0540b9c
|
3 |
+
size 70192
|
presentation_assistant/__init__.py
ADDED
File without changes
|
presentation_assistant/env_set.py
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import subprocess
|
2 |
+
import os
|
3 |
+
import sys
|
4 |
+
|
5 |
+
sys.path.append("/home/user/app")
|
6 |
+
|
7 |
+
def env_set():
|
8 |
+
# ํจํค์ง๊ฐ ์ด๋ฏธ ์ค์น๋์ด ์๋์ง ํ์ธ
|
9 |
+
installed_packages = subprocess.check_output("pip list", shell=True).decode()
|
10 |
+
|
11 |
+
if "PyPDF2" not in installed_packages:
|
12 |
+
subprocess.run(f"pip install PyPDF2", shell=True)
|
13 |
+
|
14 |
+
if "openai" not in installed_packages:
|
15 |
+
subprocess.run(f"pip install -q openai", shell=True)
|
16 |
+
|
17 |
+
if "python-pptx" not in installed_packages:
|
18 |
+
subprocess.run(f"pip install python-pptx", shell=True)
|
19 |
+
|
20 |
+
# pandoc ์คํ ๊ถํ ์ค์
|
21 |
+
if not os.access("./pandoc-2.14.2/bin/pandoc", os.X_OK):
|
22 |
+
subprocess.run(f"chmod +x ./pandoc-2.14.2/bin/pandoc", shell=True)
|
23 |
+
|
24 |
+
# ๋๋ ํ ๋ฆฌ ๊ถํ ์ค์
|
25 |
+
if not os.access(".", os.W_OK):
|
26 |
+
subprocess.run(f"chmod -R 777 .", shell=True)
|
27 |
+
|
28 |
+
# subprocess.run(f"wget https://github.com/jgm/pandoc/releases/download/2.14.2/pandoc-2.14.2-linux-amd64.tar.gz", shell=True)
|
29 |
+
# subprocess.run(f"tar -xvf pandoc-2.14.2-linux-amd64.tar.gz", shell=True)
|
30 |
+
# subprocess.run(f"wget https://nodejs.org/dist/v17.0.1/node-v17.0.1-linux-x64.tar.xz", shell=True)
|
31 |
+
# subprocess.run(f"tar -xf node-v17.0.1-linux-x64.tar.xz", shell=True)
|
32 |
+
# subprocess.run(f"mv node-v17.0.1-linux-x64 node", shell=True)
|
33 |
+
# subprocess.run(f"export PATH=/home/user/app/node/bin:$PATH", shell=True)
|
34 |
+
# subprocess.run(f"/home/user/app/node/ install -g npm", shell=True)
|
35 |
+
# subprocess.run(f"apt-get install -f", shell=True)
|
36 |
+
# subprocess.run(f"apt-get install -y fonts-nanum", shell=True)
|
37 |
+
# subprocess.run(f"fc-cache -fv", shell=True)
|
38 |
+
# subprocess.run(f"rm ~/.cache/matplotlib -rf", shell=True)
|
39 |
+
|
presentation_assistant/presentation_assistant.py
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import PyPDF2
|
3 |
+
from pptx import Presentation
|
4 |
+
import openai
|
5 |
+
import subprocess
|
6 |
+
from io import BytesIO
|
7 |
+
import sys
|
8 |
+
|
9 |
+
sys.path.append("/home/user/app")
|
10 |
+
|
11 |
+
# Function to generate text2ppt input prompt
|
12 |
+
def generate_text2ppt_input_prompt(input_type, input_value, input_pages):
|
13 |
+
header = """
|
14 |
+
Assume you are a designer creating a PPT using markdown syntax, and write a PPT of %s pages.
|
15 |
+
+++ Summarize the content or link below in markdown language, adhering to the rules in ===, and refer to the slide examples in ~~~.
|
16 |
+
+++
|
17 |
+
""" % input_pages
|
18 |
+
|
19 |
+
summary_value = ""
|
20 |
+
|
21 |
+
if input_type == "Link":
|
22 |
+
summary_value += input_value
|
23 |
+
summary_value += "\n"
|
24 |
+
elif input_type == "Text":
|
25 |
+
summary_value += input_value
|
26 |
+
summary_value += "\n"
|
27 |
+
elif input_type == "PDF":
|
28 |
+
with open(input_value, 'rb') as pdf_file:
|
29 |
+
pdf_reader = PyPDF2.PdfReader(pdf_file)
|
30 |
+
num_pages = len(pdf_reader.pages)
|
31 |
+
|
32 |
+
# Convert the content of each page to a string.
|
33 |
+
text = ""
|
34 |
+
for page_num in range(num_pages):
|
35 |
+
page = pdf_reader.pages[page_num]
|
36 |
+
text += page.extract_text()
|
37 |
+
summary_value += text
|
38 |
+
summary_value += "\n"
|
39 |
+
else:
|
40 |
+
print("ERROR: Invalid input")
|
41 |
+
|
42 |
+
rule_value = """
|
43 |
+
===
|
44 |
+
- Write factually only about the content or link provided.
|
45 |
+
- Always use --- as a slide divider.
|
46 |
+
- Design and arrange the slides diversely with appropriate shapes, images(![Image](Image link), https://unsplash.com/ko/images/stock/non-copyrighted for actual use), tables(|-|), quotes(>), emphasis(bold, ``), emojis(https://kr.piliapp.com/twitter-symbols/), icons (https://kr.piliapp.com/symbol/#popular).
|
47 |
+
- Use emojis only once in every two pages, and use various other designs.
|
48 |
+
- When using images and tables, specify the size considering the page size so that all the text content appears.
|
49 |
+
- Make Slide 1 the title, for a total of %s pages.
|
50 |
+
- Write the content of the PPT richly in markdown.
|
51 |
+
- Don't explain slide by slide, just write the code.
|
52 |
+
- Don't write using the content of the example, just refer to the format.
|
53 |
+
~~~
|
54 |
+
<!-- Slide 0. Slide Topic -->
|
55 |
+
# Slide Title
|
56 |
+
![Image link](https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo-with-title.png)
|
57 |
+
- This is ๐ค**TEXT2PPT service PA!** using ChatGPT.
|
58 |
+
- Converts `link`,`text`, `PDF` input or upload into PPT.
|
59 |
+
""" % input_pages
|
60 |
+
|
61 |
+
return header + summary_value + rule_value
|
62 |
+
|
63 |
+
|
64 |
+
# Function to execute text2ppt
|
65 |
+
def text2ppt(token_key, input_prompt, input_theme):
|
66 |
+
openai.api_key = token_key
|
67 |
+
|
68 |
+
messages = [
|
69 |
+
{"role": "system", "content": "You are a kind helpful PPT designer."},
|
70 |
+
]
|
71 |
+
|
72 |
+
message = input_prompt
|
73 |
+
|
74 |
+
if message:
|
75 |
+
messages.append(
|
76 |
+
{"role": "user", "content": message},
|
77 |
+
)
|
78 |
+
chat = openai.ChatCompletion.create(
|
79 |
+
model="gpt-3.5-turbo-0301", messages=messages
|
80 |
+
)
|
81 |
+
|
82 |
+
reply = chat.choices[0].message.content
|
83 |
+
messages.append({"role": "assistant", "content": reply})
|
84 |
+
|
85 |
+
md_text = reply[4:] if reply[:3] == "---" else reply
|
86 |
+
md_text_list = md_text.split('\n')
|
87 |
+
|
88 |
+
f = open("text2ppt_input.md", 'w')
|
89 |
+
for i in range(0, len(md_text_list)):
|
90 |
+
data = md_text_list[i] + "\n"
|
91 |
+
f.write(data)
|
92 |
+
f.close()
|
93 |
+
|
94 |
+
if input_theme == 'default':
|
95 |
+
subprocess.run(["/home/user/app/pandoc-2.14.2/bin/pandoc", "/home/user/app/text2ppt_input.md", "-t", "pptx", "-o", "/home/user/app/text2ppt_output.pptx"], capture_output=True)
|
96 |
+
else:
|
97 |
+
ppt_theme = "--reference-doc=/home/user/app/template/"+input_theme+".pptx"
|
98 |
+
subprocess.run(["/home/user/app/pandoc-2.14.2/bin/pandoc", "/home/user/app/text2ppt_input.md", "-t", "pptx", ppt_theme, "-o", "/home/user/app/text2ppt_output.pptx"], capture_output=True)
|
99 |
+
|
100 |
+
|
101 |
+
def ppt2script(token_key, input_file, input_type):
|
102 |
+
openai.api_key = token_key
|
103 |
+
|
104 |
+
if input_type=="PDF":
|
105 |
+
with open(input_file, 'rb') as pdf_file:
|
106 |
+
pdf_reader = PyPDF2.PdfReader(pdf_file)
|
107 |
+
num_pages = len(pdf_reader.pages)
|
108 |
+
|
109 |
+
# Convert the content of each page to a string.
|
110 |
+
text = ""
|
111 |
+
for page_num in range(num_pages):
|
112 |
+
page = pdf_reader.pages[page_num]
|
113 |
+
text += "[PAGE_NUM " + str(page_num + 1) + "]"
|
114 |
+
text += page.extract_text()
|
115 |
+
else:
|
116 |
+
prs = Presentation(input_file)
|
117 |
+
|
118 |
+
text = ""
|
119 |
+
page_num = 0
|
120 |
+
for slide in prs.slides:
|
121 |
+
text += "[PAGE_NUM " + str(page_num + 1) + "]"
|
122 |
+
page_num += 1
|
123 |
+
for shape in slide.shapes:
|
124 |
+
if not shape.has_text_frame:
|
125 |
+
continue
|
126 |
+
for paragraph in shape.text_frame.paragraphs:
|
127 |
+
for run in paragraph.runs:
|
128 |
+
text += run.text
|
129 |
+
|
130 |
+
header = """
|
131 |
+
You are an assistant helping with PPT presentations.
|
132 |
+
~~~Follow the rules below and write a presentation script for the PPT content below.
|
133 |
+
~~~
|
134 |
+
- When [PAGE_NUM 1], where 1 is the page number, write a presentation script for each page number.
|
135 |
+
- Write only in text without using markdown language.
|
136 |
+
- Add additional explanations or examples to the PPT content.
|
137 |
+
---
|
138 |
+
"""
|
139 |
+
|
140 |
+
input_prompt = header + text
|
141 |
+
|
142 |
+
messages = [
|
143 |
+
{"role": "system", "content": "You are a kind helpful PPT Assistant."},
|
144 |
+
]
|
145 |
+
|
146 |
+
message = input_prompt
|
147 |
+
|
148 |
+
if message:
|
149 |
+
messages.append(
|
150 |
+
{"role": "user", "content": message},
|
151 |
+
)
|
152 |
+
chat = openai.ChatCompletion.create(
|
153 |
+
model="gpt-3.5-turbo-0301", messages=messages
|
154 |
+
)
|
155 |
+
|
156 |
+
reply = chat.choices[0].message.content
|
157 |
+
messages.append({"role": "assistant", "content": reply})
|
158 |
+
|
159 |
+
return reply
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
streamlit==0.88.0
|
2 |
+
altair==4.1.0
|
template/blue.pptx
ADDED
Binary file (54.9 kB). View file
|
|
template/gradation_green.pptx
ADDED
Binary file (54 kB). View file
|
|
template/green.pptx
ADDED
Binary file (39.2 kB). View file
|
|
template/yellow.pptx
ADDED
Binary file (40.8 kB). View file
|
|
text2ppt_test.md
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- Slide 1. ์ธ๊ณต์ง๋ฅ ๊ฐ์ -->
|
2 |
+
# ์ธ๊ณต์ง๋ฅ ๊ฐ์
|
3 |
+
> ์ธ๊ณต์ง๋ฅ(Artificial Intelligence)์ ์ธ๊ฐ์ ์ง๋ฅ์ ๋ชจ๋ฐฉํ์ฌ ๋ง๋ ์ปดํจํฐ ์์คํ
์
๋๋ค.
|
4 |
+
|
5 |
+
---
|
6 |
+
|
7 |
+
<!-- Slide 2. ์ธ๊ณต์ง๋ฅ ๋ถ๋ฅ -->
|
8 |
+
# ์ธ๊ณต์ง๋ฅ ๋ถ๋ฅ
|
9 |
+
<table>
|
10 |
+
<thead>
|
11 |
+
<tr>
|
12 |
+
<th>๋ถ๋ฅ</th>
|
13 |
+
<th>์ค๋ช
</th>
|
14 |
+
</tr>
|
15 |
+
</thead>
|
16 |
+
<tbody>
|
17 |
+
<tr>
|
18 |
+
<td>๊ฐํ ์ธ๊ณต์ง๋ฅ</td>
|
19 |
+
<td>์ฌ๋๊ณผ ๊ฐ์ด ๋ชจ๋ ์ธ๊ฐ์ ์์
์ ์ํ</td>
|
20 |
+
</tr>
|
21 |
+
<tr>
|
22 |
+
<td>์ฝํ ์ธ๊ณต์ง๋ฅ</td>
|
23 |
+
<td>์ผ๋ถ๋ถ์ ์์
๋ง ์ํ</td>
|
24 |
+
</tr>
|
25 |
+
</tbody>
|
26 |
+
</table>
|
27 |
+
|
28 |
+
---
|
29 |
+
|
30 |
+
<!-- Slide 3. ์ธ๊ณต์ง๋ฅ ์ ์ฉ ๋ถ์ผ -->
|
31 |
+
# ์ธ๊ณต์ง๋ฅ ์ ์ฉ ๋ถ์ผ
|
32 |
+
- ์์จ์ฃผํ ์๋์ฐจ
|
33 |
+
- ์์ฑ์ธ์ ๊ธฐ์
|
34 |
+
- ์ธ๊ณต์ง๋ฅ ์์ ์ธ์ ๊ธฐ์
|
35 |
+
- ์๋ ๋ฒ์ญ
|
36 |
+
---
|
37 |
+
|
38 |
+
<!-- Slide 4. ์ธ๊ณต์ ๊ฒฝ๋ง -->
|
39 |
+
# ์ธ๊ณต์ ๊ฒฝ๋ง
|
40 |
+
- ์๋ฌผํ์ ํผ์
ํธ๋ก ๊ตฌ์กฐ ์ฐธ๊ณ
|
41 |
+
- ์
๋ ฅ ๊ณ์ธต, ์ถ๋ ฅ ๊ณ์ธต, ์๋ ๊ณ์ธต์ผ๋ก ๊ตฌ์ฑ
|
42 |
+
![์ธ๊ณต์ ๊ฒฝ๋ง ์ด๋ฏธ์ง](https://upload.wikimedia.org/wikipedia/commons/4/46/Colored_neural_network.svg)
|
43 |
+
|
44 |
+
---
|
45 |
+
|
46 |
+
<!-- Slide 5. ์ฌ์ธตํ์ต -->
|
47 |
+
# ์ฌ์ธตํ์ต
|
48 |
+
- ๋ค์ธตํผ์
ํธ๋ก (MLP)๊ณผ ๊ฐ์ ๋คํธ์ํฌ ์์ ๋ค์ํ ๋ ์ด์ด๋ฅผ ์์ ์ฌ๋ฆผ
|
49 |
+
- ์ด๋ฏธ์ง/์์ฑ/ํ
์คํธ ๋ถ์ ๋ถ์ผ์์ ๊ด๋ฒ์ํ๊ฒ ํ์ฉ
|
50 |
+
|
51 |
+
---
|
52 |
+
|
53 |
+
<!-- Slide 6. ๊ฐํํ์ต -->
|
54 |
+
# ๊ฐํํ์ต
|
55 |
+
- ์ํธ์์ฉ์ ํตํด ์ฃผ์ด์ง ํ๊ฒฝ์ ํ์ตํ๋ ๋ฐฉ์
|
56 |
+
- ์์ด์ ํธ๊ฐ ์ต์ ์ ํ๋์ ์ทจํ๋๋ก ๋ณด์ํ๋ ๋ฐฉ์
|
57 |
+
- ์ํผ๋ง๋ฆฌ์ค ๊ฒ์/๋ฐ๋/์ฅ๊ธฐ/์ํ๊ณ ๋ฑ์์ ํ์ฉ
|
58 |
+
|
59 |
+
---
|
60 |
+
|
61 |
+
<!-- Slide 7. ์์ฐ์ด ์ฒ๋ฆฌ -->
|
62 |
+
# ์์ฐ์ด ์ฒ๋ฆฌ(NLP)
|
63 |
+
- ์ธ๊ฐ์ ์ธ์ด(์์ฑ ๋๋ ๋ฌธ์)๋ฅผ ์ปดํจํฐ๊ฐ ์ดํดํ๊ณ ์ฒ๋ฆฌ
|
64 |
+
- ๋ฅ๋ฌ๋ ์ด์ฉํ ์๋๋ฒ์ญ, ์ฑ๋ด, ํ
์คํธ ๊ฐ์ ๋ถ์ ๋ฑ
|
65 |
+
|
66 |
+
---
|
67 |
+
|
68 |
+
<!-- Slide 8. ๋ฅ๋ฌ๋ -->
|
69 |
+
# ๋ฅ๋ฌ๋
|
70 |
+
- ์ฌ์ธต์ ๊ฒฝ๋ง์ ์ด์ฉํ ๋จธ์ ๋ฌ๋ ๋ฐฉ๋ฒ๋ก
|
71 |
+
- ์ปดํจํฐ๊ฐ ์ธ๊ฐ์ ํ์ต ๋ฅ๋ ฅ์ ๋ชจ๋ฐฉํ์ฌ ์๋์ผ๋ก ํจํด ์ธ์ ๋ฌ์ฑ
|
72 |
+
- ์ด๋ฏธ์ง/์์ฑ/์์ฐ์ด ์ฒ๋ฆฌ ๋ฑ์์ ํ์ฉ
|
73 |
+
|
74 |
+
---
|
75 |
+
|
76 |
+
<!-- Slide 9. ์ธ๊ณต์ง๋ฅ์ ๋ฏธ๋ -->
|
77 |
+
# ์ธ๊ณต์ง๋ฅ์ ๋ฏธ๋
|
78 |
+
- ๊ธฐ์ ์ ๋ฐ์ ๊ณผ ํจ๊ป ์ธ๊ฐ์ ์ฌ๋ฌ ๋ถ์ผ์์ ๊ณ ๋ํ
|
79 |
+
- ๋์ฑ ํธ๋ฆฌํ๊ณ ํจ์จ์ ์ธ ์ธ๊ฐ์ ์ผ์์ํ์ ๋ณด๋ค ๋ง์ ๊ธฐ์ฌ
|
80 |
+
|
81 |
+
---
|
82 |
+
|
83 |
+
<!-- Slide 10. # PA! -->
|
84 |
+
# PA! ๐
|
85 |
+
- ๐ค**TEXT2PPT** ์๋น์ค PA!๋ฅผ ์ด์ฉํด์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค.
|
86 |
+
- ๋ฆฌ๋ทฐ๋ ๊ฑด์์ฌํญ์ ์ธ์ ๋ ์ง ํ์ํฉ๋๋ค!
|
87 |
+
- ๐ง๋ฌธ์: pa@pa.com
|