YiYiXu commited on
Commit
ace4b52
·
verified ·
1 Parent(s): 3cf3e4f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +27 -3
README.md CHANGED
@@ -1,6 +1,23 @@
1
- ## Gemini Prompt Expander
2
 
3
- ```py
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  from diffusers.modular_pipelines import ModularPipelineBlocks
5
 
6
  gemini_block = ModularPipelineBlocks.from_pretrained(
@@ -10,5 +27,12 @@ gemini_block = ModularPipelineBlocks.from_pretrained(
10
  gemini = gemini_block.init_pipeline()
11
  output = gemini(prompt="a dog sitting by the river, watching the sunset")
12
  print(f"{output.values['prompt']=}")
 
 
 
 
 
13
 
14
- ```
 
 
 
1
+ # Gemini Prompt Expander
2
 
3
+ A custom ModularPipelineBlocks that uses Google's Gemini API to expand short prompts into detailed, vivid image generation prompts.
4
+
5
+ ## Requirement
6
+
7
+ Install the Google Generative AI package:
8
+ ```bash
9
+ pip install google-generativeai
10
+ ```
11
+
12
+ ## Setup
13
+
14
+ Get your Gemini API key from [Google AI Studio](https://aistudio.google.com/apikey) and set it as an environment variable:
15
+ ```bash
16
+ export GOOGLE_API_KEY="your-api-key-here"
17
+ ```
18
+
19
+ ## Usage
20
+ ```python
21
  from diffusers.modular_pipelines import ModularPipelineBlocks
22
 
23
  gemini_block = ModularPipelineBlocks.from_pretrained(
 
27
  gemini = gemini_block.init_pipeline()
28
  output = gemini(prompt="a dog sitting by the river, watching the sunset")
29
  print(f"{output.values['prompt']=}")
30
+ ```
31
+
32
+ ## Use in Mellon
33
+
34
+ This block includes a `mellon_pipeline_config.json` for use with [Mellon](https://github.com/cubiq/Mellon):
35
 
36
+ 1. Drag a **Dynamic Block Node** from the ModularDiffusers section
37
+ 2. Enter `diffusers-internal-dev/gemini-prompt-expander` as the repo_id
38
+ 3. The node will transform to show the prompt input and expanded prompt output