Skip to content

Commit 9b2eb53

Browse files
authored
Update README.md
1 parent 96e4b13 commit 9b2eb53

File tree

1 file changed

+27
-15
lines changed

1 file changed

+27
-15
lines changed

README.md

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
<div align="center">
2-
<b>>PyPi IS NOT UPDATE! PLEASE INSTALL FROM THE REPO!</b>
3-
<br>
4-
52
<img src="https://github.com/ItsCEED/ImaginePy-Midjourney-Free-Alternative/blob/main/docs/imagine_logo.gif" width="10%">
63

74
**ImaginePy**
@@ -72,22 +69,29 @@ The following is a minimal example of using ImaginePy in a script. It gets the g
7269
from the text and increases the quality.
7370

7471
```python
75-
from imaginepy import Imagine, Style, Ratio
72+
from imaginepy import Imagine
73+
from imaginepy.constants import *
74+
7675

7776
def main():
78-
imagine = Imagine(style=Style.ANIME_V2)
77+
imagine = Imagine()
7978

8079
img_data = imagine.sdprem(
8180
prompt="Woman sitting on a table, looking at the sky, seen from behind",
82-
style=Style.ANIME_V2,
83-
ratio=Ratio.RATIO_16X9
81+
style=Style.NO_STYLE,
82+
ratio=Ratio.RATIO_16X9,
83+
negative="",
84+
seed=1000,
85+
cfg=16,
86+
model=Model.REALISTIC,
87+
asbase64=False # default is false, putting it here as presentation.
8488
)
8589

8690
if img_data is None:
8791
print("An error occurred while generating the image.")
8892
return
8993

90-
img_data = imagine.upscale(image=img_data)
94+
img_data = imagine.upscale(img_data)
9195

9296
if img_data is None:
9397
print("An error occurred while upscaling the image.")
@@ -99,6 +103,7 @@ def main():
99103
except Exception as e:
100104
print(f"An error occurred while writing the image to file: {e}")
101105

106+
102107
if __name__ == "__main__":
103108
main()
104109
```
@@ -107,16 +112,21 @@ Async version
107112

108113
```python
109114
import asyncio
110-
from imaginepy import AsyncImagine, Style, Ratio
115+
from imaginepy import AsyncImagine
116+
from imaginepy.constants import *
111117

112118

113119
async def main():
114-
imagine = AsyncImagine(style=Style.ANIME_V2)
115-
116-
img_data = await imagine.sdprem(
120+
imagine = AsyncImagine()
121+
img_data = imagine.sdprem(
117122
prompt="Woman sitting on a table, looking at the sky, seen from behind",
118-
style=Style.ANIME_V2,
119-
ratio=Ratio.RATIO_16X9
123+
style=Style.NO_STYLE,
124+
ratio=Ratio.RATIO_16X9,
125+
negative="",
126+
seed=1000,
127+
cfg=16,
128+
model=Model.REALISTIC,
129+
asbase64=False # default is false, putting it here as presentation.
120130
)
121131

122132
if img_data is None:
@@ -129,16 +139,18 @@ async def main():
129139
print("An error occurred while upscaling the image.")
130140
return
131141

132-
await imagine.close()
133142
try:
134143
with open("example.png", mode="wb") as img_file:
135144
img_file.write(img_data)
136145
except Exception as e:
137146
print(f"An error occurred while writing the image to file: {e}")
138147

148+
await imagine.close()
149+
139150

140151
if __name__ == "__main__":
141152
asyncio.run(main())
153+
142154
```
143155

144156
## Credit

0 commit comments

Comments
 (0)