Coder Social home page Coder Social logo

unofficial_midjourney_python_api's Introduction

Midjourney Python API (Unofficial)

Welcome aboard the unofficial Midjourney API πŸŽˆπŸš€. A Python wrapper around the midjourney software to generate AI-based images.

Example Image

Setup & Installation

To get started, follow the steps below to run it on your machine:

  1. Clone the repository:

    git clone https://github.com/yachty66/unofficial_midjourney_python_api.git
  2. Install the required packages from requirements.txt.

  3. If your folder structure resembles the one shown below and you wish to use the API in a file named main.py:

    project_directory
    β”‚   main.py
    β”‚
    └───unofficial_midjourney_python_api
        β”‚   midjourney_api.py

    Then, you can import the API in main.py as follows:

    from unofficial_midjourney_python_api.midjourney_api import MidjourneyApi
  4. If you haven't subscribed to midjourney yet, you should do so now.

  5. With the same Discord account you used for your midjourney subscription, create a new server (name isn't crucial) and add the midjourney bot from midjourney to this server.

  6. Next, you need to gather specific information to call the API appropriately - prompt, application_id, guild_id, channel_id, version, id, and authorization.

  7. Navigate to your discord server, open your developer console (on mac, you can use fn+f12), and open the network tab.

  8. Activate the midjourney bot with the slash command /imagine followed by an arbitrary prompt, then click on the interactions option.

  9. Firstly, visit the Headers tab and note down your Authorization key. Then, navigate to the Payload window and save the application_id, guild_id, channel_id, version, id, and authorization values from the JSON.

  10. In your project root, create a new folder named images. Any image created by the API will be saved here.

  11. Invoke the API as follows:

    midjourney = MidjourneyApi(prompt="prompt", application_id="application_id", guild_id="guild_id", channel_id="channel_id", version="version", id="id", authorization="authorization")

Wait for about 1-2 minutes, and you should find your generated image within the images folder.

Showcase of Projects Built with This API

Have you created an exciting project using the API? DM me the details at Twitter!

Happy journeying with Midjourney API!

unofficial_midjourney_python_api's People

Contributors

yachty66 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.