Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
MidjourneyPy allows developers to easily use midjourney api without complications.
pip install midjourney-py
The Midjourney 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.
from midjourney 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)
Note the task id generated will be passed to the result method to generate the imageUrl
{
"taskId": "your_task_id"
}
when passed to the result method
{
"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"
}
Describe images using the describe api from midjourney
from midjourney 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)
{
"taskId": "task_id_generated"
}
when passed to the result method
{
"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"
]
}
from midjourney 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)
{
"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"
}
The response will contain the imageURL of the upscaled image.
from midjourney import Midjourney
midjourney = Midjourney(
api_key="API_KEY", callback_uri="")
upscale = midjourney.upscale(
task_id="the_task_id", position="2")
print(upscale)
{ "imageURL": "https://..........png" }
from midjourney import Midjourney
midjourney = Midjourney(
api_key="AI_KEY", callback_uri="")
seed = midjourney.seed(task_id="the_task_id")
print(seed)
{ "taskId": "https://..........png" }
The midjourney is created to make interacting with midjourney-py easy and more structured.
I would like to extend special thanks to John Coogan and the team at midjourney for their invaluable contributions in making the midjourney-py package accessible to others. Their dedication and expertise have greatly enhanced the functionality and usability of the package. By leveraging their knowledge and efforts, developers can now seamlessly integrate the Mid Journey API into their Python projects. Their commitment to open-source collaboration and their willingness to share their expertise have been instrumental in fostering a vibrant and supportive developer community. We extend our heartfelt appreciation to John Coogan and the entire midjourney team for their outstanding contributions and for making the midjourney-py package a valuable resource for developers.
FAQs
MidjourneyPy allows developers to easily use midjourney api without complications.
We found that midjourney-py demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.