Spaces:
Running
Running
google-labs-jules[bot]
commited on
Commit
·
f146e60
1
Parent(s):
70680dd
feat: Add launch command to CLI and update README
Browse files- Add a `launch` command to the CLI to start the Streamlit app.
- Update `README.md` to include sections on Python API and CLI usage.
- README.md +28 -0
- src/slidedeckai/cli.py +37 -20
README.md
CHANGED
|
@@ -41,6 +41,34 @@ Clicking on the button will download the file.
|
|
| 41 |
In addition, SlideDeck AI can also create a presentation based on PDF files.
|
| 42 |
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
## Summary of the LLMs
|
| 45 |
|
| 46 |
SlideDeck AI allows the use of different LLMs from several online providers—Azure OpenAI, Google, Cohere, Together AI, and OpenRouter. Most of these service providers offer generous free usage of relevant LLMs without requiring any billing information.
|
|
|
|
| 41 |
In addition, SlideDeck AI can also create a presentation based on PDF files.
|
| 42 |
|
| 43 |
|
| 44 |
+
## Python API Usage
|
| 45 |
+
|
| 46 |
+
```python
|
| 47 |
+
from slidedeckai import SlideDeckAI
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
slide_generator = SlideDeckAI(
|
| 51 |
+
model='[gg]gemini-2.5-flash-lite',
|
| 52 |
+
topic='Make a slide deck on AI',
|
| 53 |
+
api_key='your-google-api-key',
|
| 54 |
+
)
|
| 55 |
+
pptx_path = slide_generator.generate()
|
| 56 |
+
print(f"Generated slide deck: {pptx_path}")
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
## CLI Usage
|
| 60 |
+
|
| 61 |
+
Generate a new slide deck:
|
| 62 |
+
```bash
|
| 63 |
+
slidedeckai generate --model '[gg]gemini-2.5-flash-lite' --topic 'Make a slide deck on AI' --api-key 'your-google-api-key'
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
Launch the Streamlit app:
|
| 67 |
+
```bash
|
| 68 |
+
slidedeckai launch
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
|
| 72 |
## Summary of the LLMs
|
| 73 |
|
| 74 |
SlideDeck AI allows the use of different LLMs from several online providers—Azure OpenAI, Google, Cohere, Together AI, and OpenRouter. Most of these service providers offer generous free usage of relevant LLMs without requiring any billing information.
|
src/slidedeckai/cli.py
CHANGED
|
@@ -2,6 +2,8 @@
|
|
| 2 |
Command-line interface for SlideDeckAI.
|
| 3 |
"""
|
| 4 |
import argparse
|
|
|
|
|
|
|
| 5 |
from .core import SlideDeckAI
|
| 6 |
|
| 7 |
def main():
|
|
@@ -9,28 +11,43 @@ def main():
|
|
| 9 |
The main function for the CLI.
|
| 10 |
"""
|
| 11 |
parser = argparse.ArgumentParser(description='Generate slide decks with SlideDeckAI.')
|
| 12 |
-
parser.
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
args = parser.parse_args()
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
if __name__ == '__main__':
|
| 36 |
main()
|
|
|
|
| 2 |
Command-line interface for SlideDeckAI.
|
| 3 |
"""
|
| 4 |
import argparse
|
| 5 |
+
import subprocess
|
| 6 |
+
import sys
|
| 7 |
from .core import SlideDeckAI
|
| 8 |
|
| 9 |
def main():
|
|
|
|
| 11 |
The main function for the CLI.
|
| 12 |
"""
|
| 13 |
parser = argparse.ArgumentParser(description='Generate slide decks with SlideDeckAI.')
|
| 14 |
+
subparsers = parser.add_subparsers(dest='command')
|
| 15 |
+
|
| 16 |
+
# 'generate' command
|
| 17 |
+
parser_generate = subparsers.add_parser('generate', help='Generate a new slide deck.')
|
| 18 |
+
parser_generate.add_argument('--model', required=True, help='The name of the LLM model to use.')
|
| 19 |
+
parser_generate.add_argument('--topic', required=True, help='The topic of the slide deck.')
|
| 20 |
+
parser_generate.add_argument('--api-key', help='The API key for the LLM provider.')
|
| 21 |
+
parser_generate.add_argument('--template-id', type=int, default=0, help='The index of the PowerPoint template to use.')
|
| 22 |
+
parser_generate.add_argument('--output-path', help='The path to save the generated .pptx file.')
|
| 23 |
+
|
| 24 |
+
# 'launch' command
|
| 25 |
+
subparsers.add_parser('launch', help='Launch the Streamlit app.')
|
| 26 |
+
|
| 27 |
args = parser.parse_args()
|
| 28 |
|
| 29 |
+
if args.command == 'generate':
|
| 30 |
+
slide_generator = SlideDeckAI(
|
| 31 |
+
model=args.model,
|
| 32 |
+
topic=args.topic,
|
| 33 |
+
api_key=args.api_key,
|
| 34 |
+
template_idx=args.template_id,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
pptx_path = slide_generator.generate()
|
| 38 |
+
|
| 39 |
+
if args.output_path:
|
| 40 |
+
import shutil
|
| 41 |
+
shutil.move(str(pptx_path), args.output_path)
|
| 42 |
+
print(f"Slide deck saved to {args.output_path}")
|
| 43 |
+
else:
|
| 44 |
+
print(f"Slide deck saved to {pptx_path}")
|
| 45 |
+
elif args.command == 'launch':
|
| 46 |
+
# Get the path to the app.py file
|
| 47 |
+
import os
|
| 48 |
+
import slidedeckai
|
| 49 |
+
app_path = os.path.join(os.path.dirname(slidedeckai.__file__), '..', '..', 'app.py')
|
| 50 |
+
subprocess.run([sys.executable, '-m', 'streamlit', 'run', app_path])
|
| 51 |
|
| 52 |
if __name__ == '__main__':
|
| 53 |
main()
|