This repository contains code for a web application that generates creative tales based on user input prompts. It utilizes the AI21 language model and the Streamlit framework for the user interface.
- Clone the repository to your local machine.
- Create a file named
apikey.pyin the same directory as the code. - Obtain an API key from AI21 and assign it to the variable
apikeyinsideapikey.py.
apikey = "YOUR_API_KEY"- Save the apikey.py file.
To run the code, follow these steps:
- Make sure you have Python installed on your machine.
- Install the required dependencies by running the following command:
pip install langchain streamlit- Run the application using the following command:
streamlit run testapp.py- Enter the number of prompts you want processed by the Large Language Model (LLM) in the provided text input field.
- For each prompt, enter your desired prompt text in the corresponding text input field. Press Enter or click outside the input field to submit the prompt.
- The entered prompts will be displayed below the input fields.
- Script templates will be created based on the entered prompts. These templates use the entered prompts and include a placeholder variable
{title}for further customization. - The created script templates will be displayed below the entered prompts.
- The templates will be linked together to form chains. Each chain consists of two LLMChain instances that are connected in sequence.
- The chains will be displayed below the script templates.
- Enter your final prompt in the text input field labeled "Enter your prompt". Press Enter or click outside the input field to submit the prompt.
- The chain with the first template as the prompt will be executed based on the final prompt entered.
- The response generated by the chain will be displayed.
- Enter how many prompts you want processed by the Large Language Model
- Input: 3
- "Generate an epic tale relating to name "
- Prompt: "Add Woof woof to the start of this title "
- Enter your final prompt: Arnav
- Input: "Arnav"
- Prompt: "Generate an epic tale relating to name Arnav"
- Output: "The tall, rising tale of legend, Arnav the great"
- Input: "The tall, rising tale of legend, Arnav the great"
- Prompt: "Add Woof woof to the start of this title The tall, rising tale of legend, Arnav the great"
- Output: "Woof woof The tall, rising tale of legend, Arnav the great"
Note: If the user interface appears differently or encounters any issues, make sure to have the necessary dependencies installed and properly configured.
Feel free to customize the prompts, template structure, or other aspects of the code to suit your specific requirements.
For any questions or support, please contact arnavpd@gmail.com.