Clone the repository containing the Streamlit app to your local machine.
git clone https://github.com/feliciien/integrating-dall-e-2-api-with-trulens-elevating-image-generation-capabilities
cd dall-e
Create a virtual environment to isolate the dependencies for the app.
python3.8 -m venv venv
source venv/bin/activate
Install the required Python dependencies from the requirements.txt
file.
pip install -r requirements.txt
Implement TruLens Evals to enhance the DALL-E 2 output. Follow TruLens documentation here or integration guide for specific instructions.
import sys
!{sys.executable} -m pip install trulens
!{sys.executable} -m pip install torchvision
!{sys.executable} -m pip install matplotlib
### Step 5: Create and Activate a Conda Environment for DALL-E
Create a Conda environment named "dall-e" to isolate the dependencies for the app.
```bash
conda create -n dall-e
Activate the "dall-e" environment using the following command:
conda activate dall-e
Install the necessary libraries using pip:
pip install streamlit langchain trulens-eval openai
To incorporate your OpenAI API key and HuggingFace Access Token into Streamlit secrets, follow these steps:
- Create a
.streamlit/secrets.toml
file within your project directory:
touch .streamlit/secrets.toml
To configure your API keys for OpenAI and HuggingFace, follow these steps:
-
create
.streamlit/secrets.toml
file in your project directory. -
Add the following lines to the file, replacing
"YOUR_API_KEY"
and"YOUR_ACCESS_TOKEN"
with your respective keys:
OPENAI_API_KEY = "YOUR_API_KEY"
HUGGINGFACE_API_KEY = "YOUR_ACCESS_TOKEN"
Run the Streamlit app using the streamlit
command.
pip install -r requirements.txt
streamlit run main.py
Access the Streamlit app in your web browser by navigating to the URL provided by Streamlit, typically http://localhost:8501.
-
Navigate to the Text-to-Image Feature
Go to the sidebar and select the "Text to Image" option.
-
Enter Your Prompt
Once on the "Text to Image" page, enter your prompt. For example, you can input "beautiful pitbull".
-
Click on Submit
After entering your prompt, click on the "Submit" button.
-
View the Result
You will receive the resulting image based on your prompt.
-
View Result in Editor
Additionally, you can view the result in the editor, which will display the output of Truelens.