barunsaha commited on
Commit
33f121d
·
1 Parent(s): 5eca302

Add CLI option to list models and disable launch (for now)

Browse files
Files changed (2) hide show
  1. README.md +9 -6
  2. src/slidedeckai/cli.py +62 -20
README.md CHANGED
@@ -13,7 +13,7 @@ license: mit
13
  # SlideDeck AI
14
 
15
  We spend a lot of time **creating** slides and organizing our thoughts for any presentation.
16
- With SlideDeck AI, co-create slide decks on any topic with **Generative Artificial Intelligence**.
17
  Describe your topic and let SlideDeck AI generate a **PowerPoint slide deck** for you—it's as simple as that!
18
 
19
 
@@ -44,16 +44,16 @@ In addition, SlideDeck AI can also create a presentation based on PDF files.
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
@@ -68,6 +68,11 @@ Launch the Streamlit app:
68
  slidedeckai launch
69
  ```
70
 
 
 
 
 
 
71
 
72
  ## Summary of the LLMs
73
 
@@ -175,5 +180,3 @@ SlideDeck AI is glad to have the following community contributions:
175
  Thank you all for your contributions!
176
 
177
  [![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors)
178
-
179
-
 
13
  # SlideDeck AI
14
 
15
  We spend a lot of time **creating** slides and organizing our thoughts for any presentation.
16
+ With SlideDeck AI, co-create slide decks on any topic with **Artificial Intelligence** and **Large Language Models**.
17
  Describe your topic and let SlideDeck AI generate a **PowerPoint slide deck** for you—it's as simple as that!
18
 
19
 
 
44
  ## Python API Usage
45
 
46
  ```python
47
+ from slidedeckai.core 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', # Or set via environment variable
54
  )
55
  pptx_path = slide_generator.generate()
56
+ print(f'🤖 Generated slide deck: {pptx_path}')
57
  ```
58
 
59
  ## CLI Usage
 
68
  slidedeckai launch
69
  ```
70
 
71
+ List supported models (these are the only models supported by SlideDeck AI):
72
+ ```bash
73
+ slidedeckai --list-models
74
+ ```
75
+
76
 
77
  ## Summary of the LLMs
78
 
 
180
  Thank you all for your contributions!
181
 
182
  [![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors)
 
 
src/slidedeckai/cli.py CHANGED
@@ -1,31 +1,79 @@
1
  """
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():
10
  """
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,
@@ -37,17 +85,11 @@ def main():
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()
 
1
  """
2
+ Command-line interface for SlideDeck AI.
3
  """
4
  import argparse
 
5
  import sys
6
+ import shutil
7
+
8
+ from slidedeckai.core import SlideDeckAI
9
+ from slidedeckai.global_config import GlobalConfig
10
+
11
 
12
  def main():
13
  """
14
  The main function for the CLI.
15
  """
16
+ parser = argparse.ArgumentParser(description='Generate slide decks with SlideDeck AI.')
17
  subparsers = parser.add_subparsers(dest='command')
18
 
19
+ # Top-level flag to list supported models
20
+ parser.add_argument(
21
+ '-l',
22
+ '--list-models',
23
+ action='store_true',
24
+ help='List supported model keys and exit.',
25
+ )
26
+
27
  # 'generate' command
28
  parser_generate = subparsers.add_parser('generate', help='Generate a new slide deck.')
29
+ parser_generate.add_argument(
30
+ '--model',
31
+ required=True,
32
+ help=(
33
+ 'Model name to use. The model must be one of the supported models;'
34
+ ' see `--list-models` for details.'
35
+ ' Model name must be in the `[provider-code]model_name` format.'
36
+ ),
37
+ )
38
+ parser_generate.add_argument(
39
+ '--topic',
40
+ required=True,
41
+ help='The topic of the slide deck.',
42
+ )
43
+ parser_generate.add_argument(
44
+ '--api-key',
45
+ help=(
46
+ 'The API key for the LLM provider. Alternatively, set the appropriate API key'
47
+ ' in the environment variable.'
48
+ ),
49
+ )
50
+ parser_generate.add_argument(
51
+ '--template-id',
52
+ type=int,
53
+ default=0,
54
+ help='The index of the PowerPoint template to use.',
55
+ )
56
+ parser_generate.add_argument(
57
+ '--output-path',
58
+ help='The path to save the generated .pptx file.',
59
+ )
60
 
61
+ # Note: the 'launch' command has been intentionally disabled.
62
+
63
+ # If no arguments are provided, show help and exit
64
+ if len(sys.argv) == 1:
65
+ parser.print_help()
66
+ return
67
 
68
  args = parser.parse_args()
69
 
70
+ # If --list-models flag was provided, print models and exit
71
+ if getattr(args, 'list_models', False):
72
+ print('Supported SlideDeck AI models (these are the only supported models):')
73
+ for k in GlobalConfig.VALID_MODELS:
74
+ print(k)
75
+ return
76
+
77
  if args.command == 'generate':
78
  slide_generator = SlideDeckAI(
79
  model=args.model,
 
85
  pptx_path = slide_generator.generate()
86
 
87
  if args.output_path:
 
88
  shutil.move(str(pptx_path), args.output_path)
89
+ print(f'\n🤖 Slide deck saved to: {args.output_path}')
90
  else:
91
+ print(f'\n🤖 Slide deck saved to: {pptx_path}')
92
+
 
 
 
 
 
93
 
94
  if __name__ == '__main__':
95
  main()