Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsDocument loadersDocument transformersText embedding modelsVector storesRetrieversToolsAlpha VantageApifyArXivAWS LambdaShell (bash)Bearly Code InterpreterBing SearchBrave SearchChatGPT PluginsDall-E Image GeneratorDataForSeoDuckDuckGo SearchEden AIEleven Labs Text2SpeechFile SystemGolden QueryGoogle DriveGoogle PlacesGoogle SearchGoogle SerperGradioGraphQLHuggingFace Hub ToolsHuman as a toolIFTTT WebHooksLemon AgentMetaphor SearchNuclia UnderstandingOpenWeatherMapPubMedRequestsSceneXplainSearch ToolsSearchApiSearxNG SearchSerpAPITwilioWikipediaWolfram AlphaYahoo Finance NewsYouTubeZapier Natural Language ActionsAgents and toolkitsMemoryCallbacksChat loadersComponentsToolsDall-E Image GeneratorOn this pageDall-E Image GeneratorThis notebook shows how you can generate images from a prompt synthesized using an OpenAI LLM. The images are generated using Dall-E, which uses the same OpenAI API key as the LLM.# Needed if you would like to display images in the notebookpip install opencv-python scikit-imagefrom langchain.llms import OpenAIimport osos.environ["OPENAI_API_KEY"] = "<your-key-here>"Run as a chain‚Äãfrom langchain.utilities.dalle_image_generator import DallEAPIWrapperfrom langchain.prompts import PromptTemplatefrom langchain.chains import LLMChainfrom langchain.llms import OpenAIllm = OpenAI(temperature=0.9)prompt = PromptTemplate(    input_variables=["image_desc"],    template="Generate a detailed prompt to generate an image based on the following description: {image_desc}",)chain = LLMChain(llm=llm, prompt=prompt)image_url = DallEAPIWrapper().run(chain.run("halloween night at a haunted museum"))image_url
This notebook shows how you can generate images from a prompt synthesized using an OpenAI LLM. The images are generated using Dall-E, which uses the same OpenAI API key as the LLM.
This notebook shows how you can generate images from a prompt synthesized using an OpenAI LLM. The images are generated using Dall-E, which uses the same OpenAI API key as the LLM. ->: Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsDocument loadersDocument transformersText embedding modelsVector storesRetrieversToolsAlpha VantageApifyArXivAWS LambdaShell (bash)Bearly Code InterpreterBing SearchBrave SearchChatGPT PluginsDall-E Image GeneratorDataForSeoDuckDuckGo SearchEden AIEleven Labs Text2SpeechFile SystemGolden QueryGoogle DriveGoogle PlacesGoogle SearchGoogle SerperGradioGraphQLHuggingFace Hub ToolsHuman as a toolIFTTT WebHooksLemon AgentMetaphor SearchNuclia UnderstandingOpenWeatherMapPubMedRequestsSceneXplainSearch ToolsSearchApiSearxNG SearchSerpAPITwilioWikipediaWolfram AlphaYahoo Finance NewsYouTubeZapier Natural Language ActionsAgents and toolkitsMemoryCallbacksChat loadersComponentsToolsDall-E Image GeneratorOn this pageDall-E Image GeneratorThis notebook shows how you can generate images from a prompt synthesized using an OpenAI LLM. The images are generated using Dall-E, which uses the same OpenAI API key as the LLM.# Needed if you would like to display images in the notebookpip install opencv-python scikit-imagefrom langchain.llms import OpenAIimport osos.environ["OPENAI_API_KEY"] = "<your-key-here>"Run as a chain‚Äãfrom langchain.utilities.dalle_image_generator import DallEAPIWrapperfrom langchain.prompts import PromptTemplatefrom langchain.chains import LLMChainfrom langchain.llms import OpenAIllm = OpenAI(temperature=0.9)prompt = PromptTemplate(    input_variables=["image_desc"],    template="Generate a detailed prompt to generate an image based on the following description: {image_desc}",)chain = LLMChain(llm=llm, prompt=prompt)image_url = DallEAPIWrapper().run(chain.run("halloween night at a haunted museum"))image_url