PyMidjourney


NamePyMidjourney JSON
Version 1.0.0 PyPI version JSON
download
home_page
SummaryPyMidjourney allows developers to easily use midjourney api without complications.
upload_time2023-07-05 12:19:22
maintainer
docs_urlNone
authorAjaga Abdulbasit (Code Ninja)
requires_python
license
keywords python ai midjourney image request stable stable difusion difusion
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# PyMidjourney

PyMidjourney library provides a simplified and convenient way for developers to interact with the Midjourney API. With this library, developers can easily integrate Midjourney's powerful image processing capabilities into their applications without dealing with the complexities of manual API calls.

## Key Features

1. _Simplified Interface_: The APIRequest class abstracts away the complexities of API
2. _Authentication Handling_: he library handles the authentication process, ensuring that API requests are properly authenticated with the provided API key.
3. _Endpoint Methods_: The library provides intuitive methods for each API endpoint, making it easy to perform actions such as describing images, retrieving results, upscaling images, generating images based on prompts, and generating seeds for image generation.
4. _Response Handling_: The library processes API responses and provides them in a structured format, simplifying the integration of API results into the application workflow.

### Using the Imagine API

```python

from pymidjourney import Midjourney

midjourney = Midjourney(
    api_key="API_KEY", callback_uri="")

# IMAGINE
seed = midjourney.imagine(prompt='cute mouse with hats')

result = midjourney.result(seed=seed)
if result.get('status') == 'completed':
    response = result
    print(response)
else:
    message = result.get('message')
    print(message)

```

### Using the Describe API

Describe images using the describe api from midjourney

```python

from pymidjourney import Midjourney


midjourney = Midjourney(
    api_key="API_KEY", callback_uri="")

seed = midjourney.describe(
    image_path=r"C:\Users\Basit Ng\Downloads\rabbit.png")

result = midjourney.result(seed=seed)
if result.get('status') == 'completed':
    response = result
    print(response)
else:
    message = result.get('message')
    print(message)


```

#### Describe response

```json
{
  "taskId": "task_id_generated"
}
```

when passed to the result method

```json
{
  "status": "completed",
  "content": [
    "1️⃣ four images of a lion lying in water, in the style of cinematic sets, fantasy characters, cinematic lighting, ray tracing, soggy, naturalistic bird portraits, strong facial expression ",
    "2️⃣ four different images of a lion sitting in the water, in the style of vray tracing, realistic, emotive portraits, bokeh, [noah bradley](https://goo.gl/search?artist%20noah%20bradley), fairy tale, photorealistic compositions, 8k ",
    "3️⃣ lion portraits in the water, in the style of [raphael lacoste](https://goo.gl/search?artist%20raphael%20lacoste), bokeh, detailed character expressions, [charles spencelayh](https://goo.gl/search?artist%20charles%20spencelayh), emotional and dramatic scenes, nature inspired, fawncore ",
    "4️⃣ the lion  lion photo editing, lion phototutorials, lionphotography, portrait photography, animal photography, lion photo, in the style of vray tracing, wet-on-wet blending, multi-panel compositions, rendered in cinema4d, 8k 3d, fairy tale, bokeh"
  ]
}
```

#### Imagine response

_Note_ the _task id_ generated will be passed to the result method to generate the imageUrl

```json
{
  "taskId": "your_task_id"
}
```

when passed to the result method

```json
{
  "status": "completed",
  "imageUrl": "https://cdn.discordapp.com/attachments/1124090271676772432/1126110757319360582/olivier_A_crying_white_kid_holding_a_blue_candy_splash_around_h_5b0a4099-f398-4118-8206-33f64c1a5589.png"
}
```

### Using the RESULT API

```python

from pymidjourney import Midjourney


midjourney = Midjourney(
    api_key="API_KEY", callback_uri="")

seed = {
    "taskId": 'your_task_id',
}
result = midjourney.result(seed=seed)
if result.get('status') == 'completed':
    response = result
    print(response)
else:
    message = result.get('message')
    print(message)

```

#### Result response

```json
{
  "imageURL": "https://cdn.discordapp.com/attachments/1124090271676772432/1125924854990917713/njho_Lion_king_8k_ultra_reality_in_a_rainy_zone___4410563673654_de36ac34-3209-4940-ab10-7178305ca75f.png"
}
```

### Using the UPSCALE API

The response will contain the imageURL of the upscaled image.

```python
from pymidjourney import Midjourney

midjourney = Midjourney(
    api_key="API_KEY", callback_uri="")

upscale = midjourney.upscale(
    task_id="the_task_id", position="2")

print(upscale)

```

#### Upscale response

```json
{ "imageURL": "https://..........png" }
```

### Using the SEED API

```python
from pymidjourney import Midjourney

midjourney = Midjourney(
    api_key="AI_KEY", callback_uri="")

seed = midjourney.seed(task_id="the_task_id")

print(seed)
```

#### Seed response

```json
{ "taskId": "https://..........png" }
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "PyMidjourney",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,ai,midjourney,image,request,stable,stable difusion,difusion",
    "author": "Ajaga Abdulbasit (Code  Ninja)",
    "author_email": "basitng2004@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/f1/48/6e6b94ccc0707e3cc3ef1b525e1e8296a5fc2621d3738747ea1348e84301/PyMidjourney-1.0.0.tar.gz",
    "platform": null,
    "description": "\r\n# PyMidjourney\r\n\r\nPyMidjourney library provides a simplified and convenient way for developers to interact with the Midjourney API. With this library, developers can easily integrate Midjourney's powerful image processing capabilities into their applications without dealing with the complexities of manual API calls.\r\n\r\n## Key Features\r\n\r\n1. _Simplified Interface_: The APIRequest class abstracts away the complexities of API\r\n2. _Authentication Handling_: he library handles the authentication process, ensuring that API requests are properly authenticated with the provided API key.\r\n3. _Endpoint Methods_: The library provides intuitive methods for each API endpoint, making it easy to perform actions such as describing images, retrieving results, upscaling images, generating images based on prompts, and generating seeds for image generation.\r\n4. _Response Handling_: The library processes API responses and provides them in a structured format, simplifying the integration of API results into the application workflow.\r\n\r\n### Using the Imagine API\r\n\r\n```python\r\n\r\nfrom pymidjourney import Midjourney\r\n\r\nmidjourney = Midjourney(\r\n    api_key=\"API_KEY\", callback_uri=\"\")\r\n\r\n# IMAGINE\r\nseed = midjourney.imagine(prompt='cute mouse with hats')\r\n\r\nresult = midjourney.result(seed=seed)\r\nif result.get('status') == 'completed':\r\n    response = result\r\n    print(response)\r\nelse:\r\n    message = result.get('message')\r\n    print(message)\r\n\r\n```\r\n\r\n### Using the Describe API\r\n\r\nDescribe images using the describe api from midjourney\r\n\r\n```python\r\n\r\nfrom pymidjourney import Midjourney\r\n\r\n\r\nmidjourney = Midjourney(\r\n    api_key=\"API_KEY\", callback_uri=\"\")\r\n\r\nseed = midjourney.describe(\r\n    image_path=r\"C:\\Users\\Basit Ng\\Downloads\\rabbit.png\")\r\n\r\nresult = midjourney.result(seed=seed)\r\nif result.get('status') == 'completed':\r\n    response = result\r\n    print(response)\r\nelse:\r\n    message = result.get('message')\r\n    print(message)\r\n\r\n\r\n```\r\n\r\n#### Describe response\r\n\r\n```json\r\n{\r\n  \"taskId\": \"task_id_generated\"\r\n}\r\n```\r\n\r\nwhen passed to the result method\r\n\r\n```json\r\n{\r\n  \"status\": \"completed\",\r\n  \"content\": [\r\n    \"1\ufe0f\u20e3 four images of a lion lying in water, in the style of cinematic sets, fantasy characters, cinematic lighting, ray tracing, soggy, naturalistic bird portraits, strong facial expression \",\r\n    \"2\ufe0f\u20e3 four different images of a lion sitting in the water, in the style of vray tracing, realistic, emotive portraits, bokeh, [noah bradley](https://goo.gl/search?artist%20noah%20bradley), fairy tale, photorealistic compositions, 8k \",\r\n    \"3\ufe0f\u20e3 lion portraits in the water, in the style of [raphael lacoste](https://goo.gl/search?artist%20raphael%20lacoste), bokeh, detailed character expressions, [charles spencelayh](https://goo.gl/search?artist%20charles%20spencelayh), emotional and dramatic scenes, nature inspired, fawncore \",\r\n    \"4\ufe0f\u20e3 the lion  lion photo editing, lion phototutorials, lionphotography, portrait photography, animal photography, lion photo, in the style of vray tracing, wet-on-wet blending, multi-panel compositions, rendered in cinema4d, 8k 3d, fairy tale, bokeh\"\r\n  ]\r\n}\r\n```\r\n\r\n#### Imagine response\r\n\r\n_Note_ the _task id_ generated will be passed to the result method to generate the imageUrl\r\n\r\n```json\r\n{\r\n  \"taskId\": \"your_task_id\"\r\n}\r\n```\r\n\r\nwhen passed to the result method\r\n\r\n```json\r\n{\r\n  \"status\": \"completed\",\r\n  \"imageUrl\": \"https://cdn.discordapp.com/attachments/1124090271676772432/1126110757319360582/olivier_A_crying_white_kid_holding_a_blue_candy_splash_around_h_5b0a4099-f398-4118-8206-33f64c1a5589.png\"\r\n}\r\n```\r\n\r\n### Using the RESULT API\r\n\r\n```python\r\n\r\nfrom pymidjourney import Midjourney\r\n\r\n\r\nmidjourney = Midjourney(\r\n    api_key=\"API_KEY\", callback_uri=\"\")\r\n\r\nseed = {\r\n    \"taskId\": 'your_task_id',\r\n}\r\nresult = midjourney.result(seed=seed)\r\nif result.get('status') == 'completed':\r\n    response = result\r\n    print(response)\r\nelse:\r\n    message = result.get('message')\r\n    print(message)\r\n\r\n```\r\n\r\n#### Result response\r\n\r\n```json\r\n{\r\n  \"imageURL\": \"https://cdn.discordapp.com/attachments/1124090271676772432/1125924854990917713/njho_Lion_king_8k_ultra_reality_in_a_rainy_zone___4410563673654_de36ac34-3209-4940-ab10-7178305ca75f.png\"\r\n}\r\n```\r\n\r\n### Using the UPSCALE API\r\n\r\nThe response will contain the imageURL of the upscaled image.\r\n\r\n```python\r\nfrom pymidjourney import Midjourney\r\n\r\nmidjourney = Midjourney(\r\n    api_key=\"API_KEY\", callback_uri=\"\")\r\n\r\nupscale = midjourney.upscale(\r\n    task_id=\"the_task_id\", position=\"2\")\r\n\r\nprint(upscale)\r\n\r\n```\r\n\r\n#### Upscale response\r\n\r\n```json\r\n{ \"imageURL\": \"https://..........png\" }\r\n```\r\n\r\n### Using the SEED API\r\n\r\n```python\r\nfrom pymidjourney import Midjourney\r\n\r\nmidjourney = Midjourney(\r\n    api_key=\"AI_KEY\", callback_uri=\"\")\r\n\r\nseed = midjourney.seed(task_id=\"the_task_id\")\r\n\r\nprint(seed)\r\n```\r\n\r\n#### Seed response\r\n\r\n```json\r\n{ \"taskId\": \"https://..........png\" }\r\n```\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "PyMidjourney allows developers to easily use midjourney api without complications.",
    "version": "1.0.0",
    "project_urls": null,
    "split_keywords": [
        "python",
        "ai",
        "midjourney",
        "image",
        "request",
        "stable",
        "stable difusion",
        "difusion"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "73618a5d5d12ecbd3dbbfea9ae718620749edbce3a8a3cb11c0d7a7b59aec623",
                "md5": "7ff6e90762318a39cb476b6505cd78e5",
                "sha256": "3c3a55f6c47f65eb05374794f50fb610b94926960154147049fb3435f3e16d7c"
            },
            "downloads": -1,
            "filename": "PyMidjourney-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7ff6e90762318a39cb476b6505cd78e5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5206,
            "upload_time": "2023-07-05T12:19:19",
            "upload_time_iso_8601": "2023-07-05T12:19:19.496082Z",
            "url": "https://files.pythonhosted.org/packages/73/61/8a5d5d12ecbd3dbbfea9ae718620749edbce3a8a3cb11c0d7a7b59aec623/PyMidjourney-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f1486e6b94ccc0707e3cc3ef1b525e1e8296a5fc2621d3738747ea1348e84301",
                "md5": "7bbed92e5491dcb4c249d8d59f50f6c2",
                "sha256": "3a852d18b034216f8d26d761f059a036ac0b55db9946e9defbfdc4c5568f1a01"
            },
            "downloads": -1,
            "filename": "PyMidjourney-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "7bbed92e5491dcb4c249d8d59f50f6c2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5112,
            "upload_time": "2023-07-05T12:19:22",
            "upload_time_iso_8601": "2023-07-05T12:19:22.807514Z",
            "url": "https://files.pythonhosted.org/packages/f1/48/6e6b94ccc0707e3cc3ef1b525e1e8296a5fc2621d3738747ea1348e84301/PyMidjourney-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-05 12:19:22",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pymidjourney"
}
        
Elapsed time: 0.08705s