Skip to content

Commit

Permalink
Merge pull request #171 from griptape-ai:remove/black-forest
Browse files Browse the repository at this point in the history
Remove/black-forest
  • Loading branch information
shhlife authored Nov 27, 2024
2 parents eab7e3c + b850c60 commit da0bf86
Show file tree
Hide file tree
Showing 13 changed files with 8 additions and 394 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ You can previous and download more examples [here](examples/README.md).

## Recent Changelog

### Nov 28, 2024
* ⚠️ **Temporarily removed BlackForestLabs Driver nodes while resolving install issues**. There appears to be an installation issue for these nodes, so I'm _temporarily_ removing them until it's resolved.

### Nov 27, 2024

* Added example: [PDF -> Profile Pic](examples/pdf_to_profile_pic.png) where a resume in pdf form is summarized, then used as inspiration for an image generation prompt to create a profile picture.
Expand Down
6 changes: 0 additions & 6 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@
gtUIAzureOpenAiImageGenerationDriver,
)

# - BlackForest Labs
from .nodes.drivers.gtUIBlackForestImageGenerationDriver import (
gtUIBlackForestImageGenerationDriver,
)

# - Cohere
from .nodes.drivers.gtUICohereEmbeddingDriver import gtUICohereEmbeddingDriver
from .nodes.drivers.gtUICoherePromptDriver import gtUICoherePromptDriver
Expand Down Expand Up @@ -376,7 +371,6 @@
"Griptape Driver: Amazon Bedrock Stable Diffusion": gtUIAmazonBedrockStableDiffusionImageGenerationDriver,
"Griptape Driver: Amazon Bedrock Titan": gtUIAmazonBedrockTitanImageGenerationDriver,
"Griptape Driver: Azure OpenAI Image Generation": gtUIAzureOpenAiImageGenerationDriver,
"Griptape Driver: Black Forest Labs Image Generation": gtUIBlackForestImageGenerationDriver,
"Griptape Driver: Leonardo.AI": gtUILeonardoImageGenerationDriver,
"Griptape Driver: OpenAI Image Generation": gtUIOpenAiImageGenerationDriver,
"Griptape Driver: OpenAI Compatible Image Generation": gtUIOpenAiCompatibleImageGenerationDriver,
Expand Down
20 changes: 0 additions & 20 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,6 @@ Uses `Griptape Load: Text` node to import a PDF of a robot resume, then the `Gri
![Profile Pic](pdf_to_profile_pic.png)
Download: [pdf_to_profile_pic.png](pdf_to_profile_pic.png)

## Black Forest Labs - Flux Pro 1.1 Image Generation
Use Black Forest Labs Flux models with Griptape!

![BFL Flux-Pro-1.1](griptape_black_forest_labs_create_image.png)
Download: [griptape_black_forest_labs_create_image.png](griptape_black_forest_labs_create_image.png)

## Black Forest Labs - Flux Pro 1.0-Canny - Image Variation

Use Black Forest Labs Flux-Pro-1.0-canny with Griptape to create a variation on an image.

![BFL flux-pro-1.0-canny](griptape_black_forest_labs_create_variation.png)
Download: [griptape_black_forest_labs_create_variation.png](griptape_black_forest_labs_create_variation.png)

## Black Forest Labs - Flux Pro 1.0-Fill - Image Inpainting

Use Black Forest Labs Flux-Pro-1.0-fill with Griptape to perform inpainting on an image.

![BFL flux-pro-1.0-fill](griptape_black_forest_flux_inpainting.png)
Download: [griptape_black_forest_flux_inpainting.png](griptape_black_forest_flux_inpainting.png)

## Griptape Expert Photographers
Use Agents as experts in their field to help provide feedback that will generate more advanced outputs. Utilizes multiple models - including Ollama running locally. If you don't have Ollama installed, feel free to use another `prompt_driver`.

Expand Down
Binary file removed examples/griptape_black_forest_flux_inpainting.png
Binary file not shown.
Binary file removed examples/griptape_black_forest_labs_create_image.png
Binary file not shown.
Binary file not shown.
95 changes: 3 additions & 92 deletions js/NodesWithVisibilityToggles.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,97 +4,8 @@ import { formatAndDisplayJSON } from "./gtUIUtils.js";
import { hideWidget, showWidget } from "./utils.js";
import { app } from "../../../scripts/app.js";
export function setupVisibilityToggles(nodeType, nodeData, app) {
if (nodeData.name.includes("Black Forest Labs Image Generation")) {
setupBlackForestLabsImageGenerationNode(nodeType, nodeData, app);
}
// if (nodeData.name.includes("Black Forest Labs Image Generation")) {
// setupBlackForestLabsImageGenerationNode(nodeType, nodeData, app);
// }
}

function setupBlackForestLabsImageGenerationNode(nodeType, nodeData, app) {
const onNodeCreated = nodeType.prototype.onNodeCreated;
nodeType.prototype.onNodeCreated = function () {
const me = onNodeCreated?.apply(this);
const widget_model = this.widgets.find(
(w) => w.name === "image_generation_model"
);

const width_widget = this.widgets.find((w) => w.name === "width");
const height_widget = this.widgets.find((w) => w.name === "height");
const aspect_ratio_width_widget = this.widgets.find(
(w) => w.name === "aspect_ratio_width"
);
const aspect_ratio_height_widget = this.widgets.find(
(w) => w.name === "aspect_ratio_height"
);

const raw_widget = this.widgets.find((w) => w.name === "raw");
const guidance_widget = this.widgets.find((w) => w.name === "guidance");
const steps_widget = this.widgets.find((w) => w.name === "steps");
const interval_widget = this.widgets.find((w) => w.name === "interval");
const prompt_upsampling_widget = this.widgets.find(
(w) => w.name === "prompt_upsampling"
);
const image_prompt_strength_widget = this.widgets.find((w) => w.name === "image_prompt_strength");

// Hide both widgets
widget_model.callback = async () => {
hideWidget(this, width_widget);
hideWidget(this, height_widget);
hideWidget(this, aspect_ratio_width_widget);
hideWidget(this, aspect_ratio_height_widget);
hideWidget(this, raw_widget);
hideWidget(this, guidance_widget);
hideWidget(this, steps_widget);
hideWidget(this, interval_widget);
hideWidget(this, prompt_upsampling_widget);
hideWidget(this, image_prompt_strength_widget);

switch (widget_model.value) {
case "flux-pro-1.1-ultra":
showWidget(aspect_ratio_height_widget);
showWidget(aspect_ratio_width_widget);
showWidget(raw_widget);
showWidget(image_prompt_strength_widget);
break;
case "flux-pro-1.1":
showWidget(width_widget);
showWidget(height_widget);
showWidget(prompt_upsampling_widget);
break;
case "flux-pro":
showWidget(width_widget);
showWidget(height_widget);
showWidget(prompt_upsampling_widget);
showWidget(interval_widget);
showWidget(guidance_widget);
showWidget(steps_widget);
break;
case "flux-dev":
showWidget(width_widget);
showWidget(height_widget);
showWidget(guidance_widget);
showWidget(steps_widget);
showWidget(prompt_upsampling_widget);
break;
case "flux-pro-1.0-depth":
case "flux-pro-1.0-canny":
showWidget(guidance_widget);
showWidget(steps_widget);
showWidget(prompt_upsampling_widget);
break;
case "flux-pro-1.0-fill":
showWidget(guidance_widget);
showWidget(steps_widget);
showWidget(prompt_upsampling_widget);
break;
default:
break;
}
fitHeight(this, true);
};

setTimeout(() => {
widget_model.callback();
}, 5);
return me;
};
}
1 change: 0 additions & 1 deletion js/griptape_api_keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const keys_organized = {
"AMAZON_OPENSEARCH_INDEX_NAME",
],
Anthropic: ["ANTHROPIC_API_KEY"],
"BlackForest Labs": ["BFL_API_KEY"],
"Microsoft Azure": [
"AZURE_OPENAI_ENDPOINT",
"AZURE_OPENAI_DALL_E_3_ENDPOINT",
Expand Down
Loading

0 comments on commit da0bf86

Please sign in to comment.