shethjenil
commited on
Upload 2 files
Browse files- AIMAGE.exe +2 -2
- AIMAGE.py +21 -12
AIMAGE.exe
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:acb94b451549526fcf57b208b0f5ab9b6cd3cfcae71cc75b10342535a99ad754
|
3 |
+
size 38548043
|
AIMAGE.py
CHANGED
@@ -1,12 +1,21 @@
|
|
1 |
-
|
2 |
-
from
|
3 |
-
from
|
4 |
-
from
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
try:
|
2 |
+
from requests import post
|
3 |
+
from io import BytesIO
|
4 |
+
from PIL.Image import open as open_image
|
5 |
+
from tkinter.simpledialog import askstring
|
6 |
+
from tkinter.messagebox import showerror
|
7 |
+
hfapi = "hf_token"
|
8 |
+
while True:
|
9 |
+
text = askstring("IMAGE PROMPT",prompt="What is your prompt?")
|
10 |
+
if text and text.strip() != "":
|
11 |
+
postreq = post("https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-xl-base-1.0", headers={"Authorization": f"Bearer {hfapi}"}, json={"inputs": text.strip()})
|
12 |
+
if postreq.status_code == 200:
|
13 |
+
open_image(BytesIO(postreq.content)).show()
|
14 |
+
else:
|
15 |
+
showerror("ERROR",f"Error: Software is out of service or your internet connection is not working.")
|
16 |
+
break
|
17 |
+
else:
|
18 |
+
break
|
19 |
+
except Exception:
|
20 |
+
showerror("ERROR",f"Error: Software is out of service or your internet connection is not working.")
|
21 |
+
|