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 lines303132333334353636373839394041424312 unmodified lines56575858596061626329 unmodified lines
1. 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.2. Subsequently, it uses the `python-pptx` library to generate the slides, 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.3. At this stage onward, a user can provide additional instructions to *refine* the content.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.4. Every time SlideDeck AI generates a PowerPoint presentation, a download button is provided.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. Visit the respective websites to obtain the keys.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 Demo11 unmodified lines12131415151617104 unmodified lines12212312412612712512612712812911 unmodified lines)from langchain_core.messages import HumanMessagefrom langchain_core.prompts import ChatPromptTemplate# from transformers import AutoTokenizer
from global_config import GlobalConfigfrom helpers import llm_helper, pptx_helper, text_helper104 unmodified lines with 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)' '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 lines62636465666566676869707161 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.' '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 lines4567789103 unmodified lines1415161717181920212223243 unmodified linesimport osimport randomfrom io import BytesIOfrom typing import Union, Tuple, Optionalfrom typing import Union, Tuple, Literalfrom urllib.parse import urlparse, parse_qs
import requests3 unmodified linesMAX_PHOTOS = 2
def search_pexels(query: str, size: Optional[str] = 'medium', per_page: int = MAX_PHOTOS):def 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