This Streamlit app harnesses the power of Google's Gemini API to generate creative text formats, including poems, code, scripts, musical pieces, email, letters, etc., based on your prompts. It offers two primary features:
- Generate Text: Enter a prompt, and the app will create a text continuation using Gemini's text-generation capabilities.
- Generate Image (Coming Soon): This feature will enable you to generate images from text prompts, offering a visual dimension to your creativity.
- Clone this repository:
git clone https://github.com/princexoleo/gemini-pro-api-streamlit.git
- Install dependencies:
pip install -r requirements.txt
- Set up a .env file:
- Create a file named
.env
in the project's root directory. - Add the following line, replacing
YOUR_API_KEY
with your actual Google API key:GOOGLE_API_KEY=YOUR_API_KEY
- Ensure you have enabled the Gemini API in your Google Cloud project.
- Create a file named
- Navigate to the project directory:
cd gemini-text-generation-demo # Or your chosen project name
- Run the Streamlit app:
streamlit run main.py
- Access the app in your web browser. The link will be provided in the terminal after starting the app.
- Choose a task:
- Select "Generate Text" from the sidebar to generate text.
- Select "Generate Image" to experiment with image generation (coming soon).
- Enter a prompt:
- For text generation, type your prompt into the text box.
- For image generation (once available), provide a descriptive prompt for the desired image.
- Click the "Generate" button:
- The app will initiate the text or image generation process (depending on the chosen task).
- View the generated output:
- The generated text or image will be displayed in the app.
- Interact with the output:
- For text, you can copy it to your clipboard or explore its formatting (if applicable).
- For images (once available), you'll be able to view and potentially save them.
- Consult the Google AI documentation for more details on Gemini API: https://cloud.google.com/natural-language