Yes, you read right! This discord bot allows you to create beatiful power point presentations from a given prompt, and with an NVIDIA GPU also automatically generates and adds images!
How it works
- The bot sends a request to the openai api with the given subject and indications in the marp markdown format
- We extract the images from the markdown and send them to the image generation api
- We generate the pdf and html files from the markdown
- We send the pdf and html files to the user
More informations on the github page. leave a
if you like it!
https://github.com/Paillat-dev/presentator
#Presentator - power point & images generator
236 messages · Page 1 of 1 (latest)
pos
?
how do i install it
or use it
@woeful sandalhow do i use chatgpt to make power point presentations?
it's not chatgpt, it's another model
ok
what is the spec requirement to run it ?
none, if you don't generate images, if you do, you will have 2 options: 1 use dalle 2 (no requirements), 2 use stable diffusion (work better with a good gpu). In a couple of days i will add dalle support, just need to do a couple adjustements).
Can i use it on mobile ?
yes of course, you just need to run/install it onto a server/computer and run it one time
Interesting. How does the image fetching work? Does it scrape a site like unsplash?
No, it generates them , you can choose between dalle 2 or stable diffusion
Hey @woeful sandal, can you please guide me how you guys are building apps like these? I also have some cool ideas but don't know from where to start. I'm a good web developer but when it comes to AI I get confused. Here are my few questions
- Do we need some kind of dataset to first train the model? Or is there any better approach?
- Any blog/video from where I can get the guidance?
No, openai already trained the models. A good point to start, is totry some things in the playground: https://beta.openai.com/playground .
Here you can type some prompts, and the AI will answer. But it's "only" a text completition AI. SO you cannot chat like chatgpt, but complete text. You need to give context, andd to "force" the AI to give you what you want.
For example, the prompt:
Here is a reciepe for a cake:
Will return you a reicepe for a cake.
But
How can i make a cake
Will sometimes something like:
without eggs?
[...]
Because the ai completed your question.
For my powerpoint generating ai, the prompt is the following:
Here is a presentation with marp. It's not possible to make slides longer than 200 characters. to separate slides,
"
---
"
then go at the line. The presentatio should be for everybody, all technical words and concepts, explained. To add an image illustration , use  at the beginning of the slide, just after \"---\". Use only .png. It's not possible to add technical images but only illustrations. The images are generated by an ai, the name of the file should be a detailed description of the image wanted. For example \" \" but don't need to show a person necessairly. The presentation is minimum 20 slides long. You can use bulletpoints. Use markdown formatting (titles, etc...). The presentation has also a conclusion. {indications} The subject of the is: {subject} The Language is: {language} <|endofprompt|>
Once you found the prompt you wanted in the playground, you can use the api, to do the exact same thing, but within your code. https://beta.openai.com/docs/api-reference/introduction . Personally i wrote my code in python, but you can also do it in plenty other languages.
@glossy bay ⬆️
Thanks @woeful sandal. I've few more questions, How can i find the right model and train it on my own data? Let's say I want AI to give result from my own data and gives result from internet if the answer isn't there in my data, how can I do this? Do I first need to create the dataset of my own and then train a pre-trained/new model to achieve this task?
Training your own model with your data is simple. You can find how to do that here: https://beta.openai.com/docs/api-reference/fine-tunes . You will need to choose a base model to start on, and then have a database of text & expected completition. To choose a base model, you have a comparaision chart here: https://beta.openai.com/docs/models/gpt-3 . The models cannot directly search on the internet. If you want to do that, i think that the best way would be to tell the ai in the prompt to answer [GOOGLE: search simply, and then do the search by yourself, give the information back to the AI, that will process the data to make it human readable. If you haven't a big amount of data, I think you can just give the data directly in the prompt. If you have a lot of data, it can be interesting training a xustom model, and sometimes, in the "expected answers of the AI, just put [GOOGLE: the search that the AI should have done in this case. If you didn't undesrtand my explanations clearly, you can ask me
@glossy bay ⬆️
Got it, thanks @woeful sandal
where do I type in the install commands?
Hello @woeful sandal, i can only install it on pc and proceed with using the app github? Cause i opened the link and read the requirements and installation, it’s pretty confusing! Should i do all this or only download and use the app?
It's important to install marp, otherwise it won't work. If you want, you can skip the image generation steps, and use dalle-2 or no images at all.
Wich steps are you not understanding?
it says bot ready, what do I do now?
Almost all these, am not a programer so i don’t know are these steps i should do or these are steps the installation automatically does? And did i get the app usage correctly? You feed in the info you need and the app will transfer them into a presentation right?
Add it to your server and run /present subject
So, first, download all the github
Then, open the terminal, right click and open terminal in teh folder you unzipped
Make sure you have python 3.9 https://www.python.org/downloads/ and pip installed https://pip.pypa.io/en/stable/installation/
Create a dicord bot and get his token here https://discord.com/developers/applications
Get an openai api key http://beta.openai.com/
Type the commands from the github
Let me try
How do I add it to my server?
In the discord dev portal, you go to oauth, then url generato, you check the "BOT" box, then elect administrator, then you copy the link at the bottom and èpaste it in your google chrome
following
@woeful sandal , Hey the bot is working now, but despite adding the sd key to the image generation, it doesn't input the images within the presentation nor does it generate them separately, any advice on this?
In can only work locally with sd, or remotely with dalle2
So try selecting dalle in the .env file
Sure thing thanks.
@woeful sandal I got this error when I tried to get it to give me a presentation with images "No connection could be made because the target machine actively refused it"
could you give me the complete error?
And also a screenshot of what your .env looks like, WITHOUT the api keys
ok
I tried this step
Local image generation (optional, only if you use the local image generation option)
Open the file called Dev Console.cmd in the stable-diffusion-ui folder and run the following commands:
uvicorn main:app --reload
but it gives me this error about
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File ".\main.py", line 1, in <module>
import sdkit
ModuleNotFoundError: No module named 'sdkit'
You need to switch to beta
So, first you start sdui with the Start Stable Diffusion UI.cmd
Then you wait
Then you go to http://localhost
Then you follow the instructions in the link above and switch to beta, remember to save
Then you close the "stable diffusion ui" command line window that opened, and reopen Start Stable Diffusion UI.cmd and wait and reclose it
And then you can start the API in the Dev-Console
whats the command to do that?
because I got an error now after making it beta version
module 'xformers'. Proceeding without it.
I got this error when I tried to turn on developer console and ran the reload command for uvicorn
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: HTTPException: 413 Payload Too Large (error code: 40005): Request entity too large
I used dalle instead but now I get this error
This is no an error, just an information
Try just ignoring this error and waiting
What is the subject that you gave it?
I can install this program on windows 10?
@woeful sandal so I struggled a little bit and it works for the most part, however I cant get it to upload more than 1 o 2 photos at maximum in the presentation, also the image is always something wayyyy off course to what I described, lastly if it managed to generate more than 2 images, right as it uploads the pdf on discord the terminal gives out an error 40005 about file to large or something. the project is amazing dont get me wrong, its jut if you have a solution to this, it would help soo soo much. thanks.
That's strange, i never had that error.
To generate more images, you can add in the indications something like "Generate at least 1 image per slide" or "Generate at least 6 images". It won't work always, but most of the time. In the mean time, you can always get the presentation in the /data/YOUR_DISCORD_USER_ID/. Here, you will have different folders, each of them contains a presentation, you can sort them by last modification to see wich one is the new one. In there you should find the complete pdf.
Could you please tell me the number of pages of the pdfs it didn't managed to send?
Hi, how to put my openai api key and discord bot token in the .env.example file and rename it to .env?
Where this is file?
Did you download the repositry from github?
Yea, I downloaded
so in the folder you should have a file called .env.example, open it in notepad
and add the values
And it's all?
If you want images, you can also set in that file images to dalle
And add obviously the bot to a discord server
How to connect the discord bot to the folder?
it's automatic
you only need to add the token to the file
and run the main.py file with python
Ok
Thanks
Tell me if you need further help
@woeful sandal this does run with python 3.11 as well right?
because I want to use only python 3.11 and above from now onwards
also do I have to have the code running all the time for this to work? because currently I have to keep the terminal open for anyone on my discord server to make a presentation
Yes
I am not using python 11 because of compatibility problems with the pycord library
I am planning to make a public version
Wdym public version? @woeful sandal
A version that you'll be able to add do your server in one click
from discord.ext import commands, the discord.ext is underlined and unresolved, when I try to run main.py
@woeful sandal
any solution to that?
pip uninstall discord
pip uninstall discord.py
pip uninstall py-cord
pip install py-cord
Run all the above commands, in the given order
ok
now when I run it, it says ready, crashes and then gives me this error @commands.cooldown(1, int(cooldown), commands.BucketType.guild)
that this line is disfunctional
can this run on python 3.10.9 ?
@sweet apex waip
Could you delete everything and reclone the repo? I changed something. (dont forget to put the correct values in the .env file
my bad @sweet apex
You can ask in my server if you need more help
i see that you'realready in it
yes small problem now
its online and connected to my server, it also accepts the command /present. However when I ask it to make a presentation, it decides to crash
n error occured: Application Command raised an exception: FileNotFoundError: [Errno 2] No such file or directory: "./data/1072467202634154044/b'cHJvYmxlbXMtYWJvdXQtd3cy'2023-02-07-14-08-58/problems-about-ww2.pdf"
.
@woeful sandal
Download marp for windows here https://github.com/marp-team/marp-cli/releases and extract the marp.exe file in the presentator folder. Do not run the file, just copy it in the resentator main folder
So its a marp problem?
yeah, pretty sure it's one
Oh no wait
fixed (it was a compatibility problem with linux and windows directoryes names)
You can download the latest here https://github.com/Paillat-dev/presentator/archive/refs/heads/main.zip
Remember to put the marp.exe file
Sorry for the inconvenience
I did everything and it works perfectly, its just that the pretty often it doesnt add images, and sometimes, not all the time, but just sometimes gives me this error @woeful sandal
@woeful sandal also can I dm you regarding this bot, as I like it very much but would like some extra features added for my server, maybe we can work on this and make it something crazier than what it is 🙂
When it generates more than 2 or 3 pictures from dalle, it crashes 🥲. @woeful sandal
The pay load is too large, how do I change the setting for that?
Error 4005
Image is for discord too large
Discord api have limit
Try generate only two images
yeah, the problem is that it cann't send large files on discord
Can you create a compression code?
i'll see if i can do in 512x512
directly
DM
ok, i'ts done, but you can directly change the code in the imagesGeneration.py file to look like this:
import requests
import os
import openai
async def generate(prompt, path, mode, openai_key):
#r = requests.get(f"http://localhost:8000/generate_image?prompt={prompt}&path={path}")
if mode == "sd":
r = requests.get(f"http://localhost:8000/generate_image?prompt={prompt}&path={path}")
return "image generated"
if mode == "dalle":
openai.api_key = openai_key
img = await openai.Image.acreate(
prompt=prompt,
n=1,
size="512x512",
)
return img
Thanks 🙂
thanks
Iis just for IOS?
Works on windows only
TY
@woeful sandal following your work and tried both Stable Diffusion and Dall-E for slides
One work example
If there a manner to change this message right in the code?
yes
main.py line 184
do you like it? Feel free to give any feedback!
How about deciding in the config to avoid putting an image on the slides? Currently reconfiguring the bot
So there would be no errors when the user doesn't want images
when the code literally has:
if use_images != "No": imageint = "To add an image illustration , use  at the beginning of the slide, just after \"---\". Use only .png. It's not possible to add technical images but only illustrations. The images are generated by an ai, the name of the file should be a detailed quite long description of the image wanted. For example \" \" but don't need to show a person necessairly."
set images to No in the .env file
if use_images != "No": means that if it is equal to no it'll ignore that part of the code
USE_IMAGES=No
reconfigured it to my instructions in my own language, this server didn't permit me to use my language here, also a clarification
"indication" should mean extra instructions or notes to the bot when creating the slides, for example, what language tone to use or which target audience the presentation is for
it should be "extra_instructions"
Changing env to setting images to no returns this error when the bot is online: Application Command raised an exception: FileNotFoundError: [WinError 2] The system cannot find the file specified:
Meanwhile, the folder where the app is placed will still produce presentation files locally. But they are not uploaded onto the Discord channel, while the error is shown.
No with capital N ?
Same code/id, different times, different approaches to content.
Ah, you mean this command is case sensitive.
yes
needs to be USE_IMAGES=No
Done, created slides successfully. This result is only two slides 😦
in the indications, say the presentation should be at least _ slides long
new update! Added new themes and improved prompts
An error occured: Application Command raised an exception: TypeError: object OpenAIObject can't be used in 'await' expression
do you always get that error or only sometimes? Can you try upgrading openai with pip install --upgrade openai?
i am getting the error every single time
already done that
before this error i am getting another error:
An error occured: Application Command raised an exception: AttributeError: type object 'Completion' has no attribute 'acreate'
i renamed the .acreate to .create in the main.py file
No. It should stay acreate Can you try uninstalling the openai lib and reinstalling it? Looks like yours isn't up to date.
Do you have different python installations on your pc?
I'm using Python 3.10
but do you have different versions installed?
.
no only python 3.10.10
sorry i dont recall ever installing openai lib
i managed to generate the powerpoint
but so far unable to use stable diffusion yet
when i do this:
Open the file called Dev Console.cmd in the stable-diffusion-ui folder and run the following commands:
uvicorn main:app --reload
I am getting:
SyntaxError: invalid syntax
INFO: Stopping reloader process [3116]
- have you switched to beta?
- have you installed uvicorn with pip installl uvicorn in the dev console AFTER switching to beta
- have you copied the correct file in the stablediffusion folder?
apparently the !DOCTYPE html tag is give syntax error
<!DOCTYPE html>
^
SyntaxError: invalid syntax
- Yes switched to beta
- after entering pip install uvicorn, it says requirement already satisfied
- i copied the main.py from presentator/img_gen_api/main.py in your github to the stablediffusion folder
from wich file? Could you snd the whole output from the terminal?
also
did you close and reopen the webui 1 time after switching?
File ".\main.py", line 8
<!DOCTYPE html>
^
SyntaxError: invalid syntax
what?
there is nothing html related in main.py
line 8 is:
#This is an API on the port 9009 that generates images from a prompt
could you open the main.py file in any app (e. notepad) and check it looks like what you can find here? https://github.com/Paillat-dev/presentator/blob/main/img_gen_api/main.py
ah ok i get it now
so i entered uvicorn main:app --reload
now its at
Model loaded
INFO: Started server process [19220]
INFO: Waiting for application startup.
INFO: Application startup complete.
does that mean i can use the discord bot already and it will generate images in the Powerpoint?
my powerpoint is still plain text atm
managed to get a picture into the powerpoint but why is it always the man wearing a hat riding a bicycle?
i mean why is the picture prompt always a man wearing a hat riding a bicycle? shouldn't it be similar to the presentation prompt
in the indication, tell him to include images related to the presentation
if you have anything you want/don't want, just put that in the indications.
UPDATE
added new themes
improved large files handling, with zip files
Lets compare and see how my method is excellent for real time examples and explanations in open ai chat , using pictures, animations, ascii art, glistening/glow/etc to give you the actual animation as the explanation. ( good for schools , hospitals , etc) .. i think you took this a step further like i want to use an image generator program which is impressive nobody has done that so far. i was just about to. if you want to collaborate let me know.
I am using https://marp.app for presentations pages layouts
Interesting
how do u switch to beta?
imagine/Neoclassical Interior design for a large Villa living room8*12m,High3.2M,
detailed sofa Java Cream2 fabric simple detailed cushion large
glass windows night mood moon appears on the sky some night
with reflected porcelain, detailed wooden neoclassical door
dosent it cost credits?
Yes, but same as the rest. Generating a presentation costs around 0.05 $ in your free credits
i put dalle on .env but it isnt generating photos what do i do
dalle lowercase
?
yes
ok
where is instruction located?
when running the /present command
you have the instructions option
it worked thx