Spaces:
Runtime error
Runtime error
Merge pull request #22 from barun-saha/visual
Browse filesFiles changed (4)
- README.md+6-4
- app.py+2-3
- global_config.py+4-2
- helpers/image_search.py+6-2
29 unmodified lines3031323334353637383940414212 unmodified lines5556575859606129 unmodified lines1. Given a topic description, it uses Mistral Nemo Instruct to generate the *initial* content of the slides.The output is generated as structured JSON data based on a pre-defined schema.2. Subsequently, it uses the `python-pptx` library to generate the slides,based on the JSON data from the previous step.A user can choose from a set of three pre-defined presentation templates.3. At this stage onward, a user can provide additional instructions to *refine* the content.For example, one can ask to add another slide or modify an existing slide.A history of instructions is maintained.4. Every time SlideDeck AI generates a PowerPoint presentation, a download button is provided.Clicking on the button will download the file.12 unmodified linesSlideDeck AI uses [Mistral-Nemo-Instruct-2407](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407)via the Hugging Face Inference API.To run this project by yourself, you need to provide the `HUGGINGFACEHUB_API_TOKEN` API key,for example, in a `.env` file. Visit the respective websites to obtain the keys.# Live Demo29 unmodified lines303132333435363738394041424312 unmodified lines565758596061626329 unmodified lines1. Given a topic description, it uses Mistral Nemo Instruct to generate the *initial* content of the slides.The output is generated as structured JSON data based on a pre-defined schema.2. Next, it uses the keywords from the JSON output to search and download a few images with a certain probability.3. Subsequently, it uses the `python-pptx` library to generate the slides,based on the JSON data from the previous step.A user can choose from a set of three pre-defined presentation templates.4. At this stage onward, a user can provide additional instructions to *refine* the content.For example, one can ask to add another slide or modify an existing slide.A history of instructions is maintained.5. Every time SlideDeck AI generates a PowerPoint presentation, a download button is provided.Clicking on the button will download the file.12 unmodified linesSlideDeck AI uses [Mistral-Nemo-Instruct-2407](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407)via the Hugging Face Inference API.To run this project by yourself, you need to provide the `HUGGINGFACEHUB_API_TOKEN` API key,for example, in a `.env` file. For image search, the `PEXEL_API_KEY` should be added.Visit the respective websites to obtain the keys.# Live Demo
11 unmodified lines12131415161718104 unmodified lines12312412512612712812913011 unmodified lines)from langchain_core.messages import HumanMessagefrom langchain_core.prompts import ChatPromptTemplate# from transformers import AutoTokenizerfrom global_config import GlobalConfigfrom helpers import llm_helper, pptx_helper, text_helper104 unmodified lineswith st.expander('Usage Instructions'):st.markdown(GlobalConfig.CHAT_USAGE_INSTRUCTIONS)st.markdown('SlideDeck AI is powered by'' [Mistral-7B-Instruct-v0.2](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2)')# view_messages = st.expander('View the messages in the session state')11 unmodified lines121314151617104 unmodified lines12212312412512612712812911 unmodified lines)from langchain_core.messages import HumanMessagefrom langchain_core.prompts import ChatPromptTemplatefrom global_config import GlobalConfigfrom helpers import llm_helper, pptx_helper, text_helper104 unmodified lineswith st.expander('Usage Instructions'):st.markdown(GlobalConfig.CHAT_USAGE_INSTRUCTIONS)st.markdown('SlideDeck AI is powered by' # noqa: E501' [Mistral-Nemo-Instruct-2407](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407).')# view_messages = st.expander('View the messages in the session state')
61 unmodified lines626364656667686961 unmodified lines' You can also ask it to refine any particular slide, e.g.:\n''- Make the slide with title \'Examples of AI\' a bit more descriptive.''\n\n''See this [demo video](https://youtu.be/QvAKzNKtk9k) for a brief walkthrough.''SlideDeck AI does not have access to the Web.''\n\n''If you like SlideDeck AI, please consider leaving a heart ❤️ on the'' [Hugging Face Space](https://huggingface.co/spaces/barunsaha/slide-deck-ai/) or'61 unmodified lines6263646566676869707161 unmodified lines' You can also ask it to refine any particular slide, e.g.:\n''- Make the slide with title \'Examples of AI\' a bit more descriptive.''\n\n''See this [demo video](https://youtu.be/QvAKzNKtk9k) for a brief walkthrough.\n\n'' SlideDeck AI does not have access to the Web, apart for searching for images relevant'' to the slides. Photos are added probabilistically; transparency needs to be changed'' manually, if required.''\n\n''If you like SlideDeck AI, please consider leaving a heart ❤️ on the'' [Hugging Face Space](https://huggingface.co/spaces/barunsaha/slide-deck-ai/) or'
3 unmodified lines456789103 unmodified lines141516171819203 unmodified linesimport osimport randomfrom io import BytesIOfrom typing import Union, Tuple, Optionalfrom urllib.parse import urlparse, parse_qsimport requests3 unmodified linesMAX_PHOTOS = 2def search_pexels(query: str, size: Optional[str] = 'medium', per_page: int = MAX_PHOTOS):"""Searches for images on Pexels using the provided query.3 unmodified lines456789103 unmodified lines14151617181920212223243 unmodified linesimport osimport randomfrom io import BytesIOfrom typing import Union, Tuple, Literalfrom urllib.parse import urlparse, parse_qsimport requests3 unmodified linesMAX_PHOTOS = 2def search_pexels(query: str,size: Literal['small', 'medium', 'large'] = 'medium',per_page: int = MAX_PHOTOS) -> dict:"""Searches for images on Pexels using the provided query.
README.md+6-4
app.py+2-3
global_config.py+4-2
helpers/image_search.py+6-2