image-upscaling-api 2025.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [2025] [Marvin Eckhardt]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.1
2
+ Name: image_upscaling_api
3
+ Version: 2025.0.0
4
+ Summary: image-upscaling.net api client
5
+ Keywords: upscale,image upscale
6
+ Author: Marvin Eckhardt
7
+ Maintainer: Marvin Eckhardt
8
+ Classifier: Programming Language :: Python
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Project-URL: Homepage, https://image-upscaling.net
11
+ Requires-Python: >=3.8
12
+ Requires-Dist: requests
13
+ Description-Content-Type: text/markdown
14
+
15
+ upscaling api Client of https://image-upscaling.net/
@@ -0,0 +1 @@
1
+ upscaling api Client of https://image-upscaling.net/
@@ -0,0 +1,35 @@
1
+ [build-system]
2
+ requires = [
3
+ "pdm-backend",
4
+ ]
5
+ build-backend = "pdm.backend"
6
+
7
+ [project]
8
+ name = "image_upscaling_api"
9
+ version = "2025.0.0"
10
+ dependencies = [
11
+ "requests",
12
+ ]
13
+ requires-python = ">=3.8"
14
+ authors = [
15
+ { name = "Marvin Eckhardt", email = "" },
16
+ ]
17
+ maintainers = [
18
+ { name = "Marvin Eckhardt", email = "" },
19
+ ]
20
+ description = "image-upscaling.net api client"
21
+ readme = "README.md"
22
+ keywords = [
23
+ "upscale",
24
+ "image upscale",
25
+ ]
26
+ classifiers = [
27
+ "Programming Language :: Python",
28
+ "License :: OSI Approved :: MIT License",
29
+ ]
30
+
31
+ [project.urls]
32
+ Homepage = "https://image-upscaling.net"
33
+
34
+ [tool.hatch.metadata]
35
+ allow-direct-references = true
@@ -0,0 +1,64 @@
1
+ import requests
2
+ import json
3
+
4
+
5
+ def upload_image(path, client_id, use_face_enhance = False, use_large_model = True, use_repair_mode = False):
6
+ # URL to the PHP script
7
+ url = "https://ai-image-upscaling.2ix.de/upload.php"
8
+
9
+ # Additional POST parameters (checkboxes, etc.)
10
+ data = {}
11
+ if(use_face_enhance):
12
+ data["fx"] = ""
13
+ if(use_large_model):
14
+ data["lm"] = ""
15
+ if(use_repair_mode):
16
+ data["rm"] = ""
17
+
18
+ # Cookie with a valid 32-digit hexadecimal client_id
19
+ cookies = {
20
+ "client_id": client_id
21
+ }
22
+
23
+ # Open the image file in binary mode
24
+ files = {
25
+ "image": open(path, "rb")
26
+ }
27
+
28
+ # Send the POST request
29
+ response = requests.post(url, data=data, files=files, cookies=cookies)
30
+
31
+ # Print the response from the server
32
+ return response.text
33
+
34
+
35
+
36
+ def get_uploaded_images(client_id):
37
+
38
+ # URL to the PHP script
39
+ url = "https://ai-image-upscaling.2ix.de/get_images_client.php"
40
+
41
+ # Cookie with a valid 32-digit hexadecimal client_id
42
+ cookies = {
43
+ "client_id": client_id
44
+ }
45
+
46
+
47
+ # Send the POST request
48
+ response = requests.get(url, cookies=cookies)
49
+
50
+ # Print the response from the server
51
+ data = json.loads(response.text)
52
+
53
+ # Access the arrays (lists)
54
+ waiting = data["images1"]
55
+ completed = data["images2"]
56
+ in_progress = data["images3"]
57
+
58
+ return waiting, completed, in_progress
59
+
60
+
61
+
62
+ # example:
63
+ # upload_image("r1.png", "481d40602d3f4570487432044df03a52", use_repair_mode=True, use_large_model = True, use_face_enhance= True)
64
+ # waiting, completed, in_progress = get_uploaded_images("481d40602d3f4570487432044df03a52")