This project is a web application that generates poems based on user-provided prompts using the OpenAI GPT-3.5-turbo model. The backend is implemented in Go, and the frontend is built with Streamlit.
- Generate poems based on user prompts.
- Uses OpenAI's GPT-3.5-turbo model for poem generation.
- Simple and intuitive Streamlit interface.
- Go 1.22.4 or later
- Python 3.7 or later
- OpenAI API key
-
Clone the repository:
git clone https://github.com/MSimsek07/poem-generator.git cd poem-generator
-
Initialize Go module:
go mod init poem-generator go mod tidy
-
Set your OpenAI API key:
export OPENAI_API_KEY=your_openai_api_key
-
Build and run the Go server:
go build -o poem-generator . ./poem-generator
The server will run on
http://localhost:8000
.
-
Install Streamlit:
pip install streamlit
-
Create
streamlit_app.py
with the given content -
Run the Streamlit app:
streamlit run streamlit_app.py
- Open your web browser and go to
http://localhost:8501
. - Enter a prompt in the text input box.
- Click the "Generate Poem" button.
- The generated poem will be displayed on the page.
main.go
: The Go backend server code.streamlit_app.py
: The Streamlit frontend code.go.mod
: The Go module file.
Contributions are welcome! Please fork the repository and submit a pull request for any changes you would like to make.
This project is licensed under the MIT License.