hussamgalal999 / Article-Generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AI_Article-Generator

To run the example Flask application with JavaScript, follow these steps:

  1. Install Required Python Packages: Open a terminal or command prompt, navigate to your project directory, and run the following command to install the required Python packages:

    pip install flask openai
  2. Obtain an OpenAI API Key: You need to have an OpenAI API key to use GPT-3. If you don't have one, you can sign up on the OpenAI website and obtain your API key.

  3. Update the Flask Application (app.py): Replace 'your_openai_api_key' in the openai.api_key line with your actual OpenAI API key.

  4. Save the Files: Save the modified app.py and templates/index.html files in your project directory.

  5. Run the Flask Application: In the terminal or command prompt, run the following command to start the Flask application:

    python app.py
  6. Access the Application: Open your web browser and go to http://localhost:5000. You should see the "Article Generator" web page.

  7. Generate an Article:

    • Enter a prompt in the text area.
    • Click the "Generate Article" button.
  8. View the Generated Article: The generated prompt and article will be displayed on the same page without a full page reload.

Remember to keep your OpenAI API key secure and do not share it publicly. This example assumes you have Python and pip installed on your system. If you encounter any issues, make sure to troubleshoot based on error messages and Python environment configurations.

About


Languages

Language:HTML 67.9%Language:Python 32.1%