Qwael 4.0.0.1.6__py3-none-any.whl → 4.0.0.2.1__py3-none-any.whl
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.
- Qwael/__init__.py +2 -1
- Qwael/vto01.py +87 -0
- {qwael-4.0.0.1.6.dist-info → qwael-4.0.0.2.1.dist-info}/METADATA +10 -3
- {qwael-4.0.0.1.6.dist-info → qwael-4.0.0.2.1.dist-info}/RECORD +7 -6
- {qwael-4.0.0.1.6.dist-info → qwael-4.0.0.2.1.dist-info}/WHEEL +0 -0
- {qwael-4.0.0.1.6.dist-info → qwael-4.0.0.2.1.dist-info}/licenses/LICENSE +0 -0
- {qwael-4.0.0.1.6.dist-info → qwael-4.0.0.2.1.dist-info}/top_level.txt +0 -0
Qwael/__init__.py
CHANGED
Qwael/vto01.py
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import torch
|
|
2
|
+
import random
|
|
3
|
+
import os
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
|
|
6
|
+
from deep_translator import GoogleTranslator
|
|
7
|
+
|
|
8
|
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
9
|
+
dtype = torch.float16 if device == "cuda" else torch.float32
|
|
10
|
+
|
|
11
|
+
TR_STYLE_MAP = {
|
|
12
|
+
"gerçekçi": "realistic",
|
|
13
|
+
"sinematik": "cinematic lighting",
|
|
14
|
+
"anime": "anime style",
|
|
15
|
+
"çizgi film": "cartoon style",
|
|
16
|
+
"karanlık": "dark dramatic mood",
|
|
17
|
+
"neon": "neon cyberpunk lighting",
|
|
18
|
+
"portre": "portrait photography",
|
|
19
|
+
"detaylı": "highly detailed",
|
|
20
|
+
"fantastik": "fantasy art",
|
|
21
|
+
"bilim kurgu": "science fiction",
|
|
22
|
+
"minimal": "minimalist composition"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
QUALITY_LOCK = (
|
|
26
|
+
"masterpiece, ultra high quality, professional photography, "
|
|
27
|
+
"sharp focus, perfect lighting, high detail, clean composition"
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
NEGATIVE_LOCK = (
|
|
31
|
+
"worst quality, low quality, lowres, blurry, jpeg artifacts, "
|
|
32
|
+
"bad anatomy, bad proportions, extra fingers, missing fingers, "
|
|
33
|
+
"extra limbs, fused fingers, malformed hands, "
|
|
34
|
+
"deformed face, asymmetrical face, cross eye, lazy eye, "
|
|
35
|
+
"distorted body, mutated, ugly"
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
translator = GoogleTranslator(source="tr", target="en")
|
|
39
|
+
|
|
40
|
+
def _build_prompt(prompt_tr: str) -> str:
|
|
41
|
+
translated = translator.translate(prompt_tr)
|
|
42
|
+
prompt_lower = prompt_tr.lower()
|
|
43
|
+
styles = []
|
|
44
|
+
for tr, en in TR_STYLE_MAP.items():
|
|
45
|
+
if tr in prompt_lower:
|
|
46
|
+
styles.append(en)
|
|
47
|
+
parts = [translated]
|
|
48
|
+
if styles:
|
|
49
|
+
parts.append(", ".join(styles))
|
|
50
|
+
parts.append(QUALITY_LOCK)
|
|
51
|
+
return ", ".join(parts)
|
|
52
|
+
|
|
53
|
+
_pipe = StableDiffusionPipeline.from_pretrained(
|
|
54
|
+
"runwayml/stable-diffusion-v1-5",
|
|
55
|
+
torch_dtype=dtype,
|
|
56
|
+
safety_checker=None
|
|
57
|
+
).to(device)
|
|
58
|
+
|
|
59
|
+
_pipe.scheduler = DPMSolverMultistepScheduler.from_config(_pipe.scheduler.config)
|
|
60
|
+
_pipe.enable_attention_slicing()
|
|
61
|
+
|
|
62
|
+
def create_text(
|
|
63
|
+
prompt: str,
|
|
64
|
+
kalite: float = 7.5,
|
|
65
|
+
cfg: float = 7.5,
|
|
66
|
+
steps: int | None = None,
|
|
67
|
+
seed: int | None = None,
|
|
68
|
+
filename: str | None = None
|
|
69
|
+
) -> str:
|
|
70
|
+
final_prompt = _build_prompt(prompt)
|
|
71
|
+
if steps is None:
|
|
72
|
+
steps = int(20 + (kalite * 2))
|
|
73
|
+
if seed is None:
|
|
74
|
+
seed = random.randint(0, 999999999)
|
|
75
|
+
generator = torch.Generator(device=device).manual_seed(seed)
|
|
76
|
+
image = _pipe(
|
|
77
|
+
prompt=final_prompt,
|
|
78
|
+
negative_prompt=NEGATIVE_LOCK,
|
|
79
|
+
num_inference_steps=steps,
|
|
80
|
+
guidance_scale=float(cfg),
|
|
81
|
+
generator=generator
|
|
82
|
+
).images[0]
|
|
83
|
+
if filename is None:
|
|
84
|
+
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
|
85
|
+
filename = f"ai_image_{timestamp}.png"
|
|
86
|
+
image.save(filename)
|
|
87
|
+
return os.path.abspath(filename)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: Qwael
|
|
3
|
-
Version: 4.0.0.1
|
|
3
|
+
Version: 4.0.0.2.1
|
|
4
4
|
Summary: Qwael: İşlevsel ve kolaylaştırılmış Python kütüphanesi
|
|
5
5
|
Author: Bedirhan
|
|
6
6
|
Author-email: bedirhan.oytpass@gmail.com
|
|
@@ -15,12 +15,19 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE
|
|
18
|
+
Requires-Dist: torch
|
|
19
|
+
Requires-Dist: diffusers
|
|
20
|
+
Requires-Dist: transformers
|
|
21
|
+
Requires-Dist: accelerate
|
|
22
|
+
Requires-Dist: safetensors
|
|
23
|
+
Requires-Dist: deep-translator
|
|
24
|
+
Requires-Dist: Pillow
|
|
25
|
+
Requires-Dist: requests
|
|
26
|
+
Requires-Dist: tqdm
|
|
18
27
|
Requires-Dist: google-api-python-client
|
|
19
28
|
Requires-Dist: google-auth
|
|
20
29
|
Requires-Dist: google-auth-oauthlib
|
|
21
30
|
Requires-Dist: google-auth-httplib2
|
|
22
|
-
Requires-Dist: Pillow
|
|
23
|
-
Requires-Dist: requests
|
|
24
31
|
Dynamic: author
|
|
25
32
|
Dynamic: author-email
|
|
26
33
|
Dynamic: classifier
|
|
@@ -2,11 +2,12 @@ Qwael/DRİVE.py,sha256=OTiyoXFb5iFP7hXr2QHnH3c0pHZijZr1sFsqguXtMfc,12976
|
|
|
2
2
|
Qwael/DoIP.py,sha256=5ujPzbZGepFZN0-tMI9Unodvo2gJG3PDL2ShqdBJjdE,418
|
|
3
3
|
Qwael/MultiDB.py,sha256=glptDsH22TyklZrA_ywStnsT6bGnq7JsSR5NN_U1NII,17286
|
|
4
4
|
Qwael/Multidata.py,sha256=YBofvzcuT-F8RIljw3Z1tr3Qn7VbhXjfrY6BuGNPYw0,9496
|
|
5
|
-
Qwael/__init__.py,sha256=
|
|
5
|
+
Qwael/__init__.py,sha256=eeFu4pKdESARPG5JxEZQG3bXnqI0k2DRuXLvA1d1tug,207
|
|
6
6
|
Qwael/filesz.py,sha256=6XZ1GKzXcVs7uKAirImbBuZYGrRL_-WOtiOOYOdp_nU,2501
|
|
7
7
|
Qwael/pgif.py,sha256=stiVsn1DAJyHNsAHUWaWXdGiouQ2ZeRehn_WC30SK1A,1242
|
|
8
|
-
|
|
9
|
-
qwael-4.0.0.1.
|
|
10
|
-
qwael-4.0.0.1.
|
|
11
|
-
qwael-4.0.0.1.
|
|
12
|
-
qwael-4.0.0.1.
|
|
8
|
+
Qwael/vto01.py,sha256=qAsPdylzdgTa21ox0kfnyCjYn06StCUVODa5N3WwNdw,2697
|
|
9
|
+
qwael-4.0.0.2.1.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
+
qwael-4.0.0.2.1.dist-info/METADATA,sha256=jAGAgjAOhmGudBaDiHYN29RuHzhIMpoHTv86GFg2Slg,2458
|
|
11
|
+
qwael-4.0.0.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
12
|
+
qwael-4.0.0.2.1.dist-info/top_level.txt,sha256=UtaXY8Mui4lwYNkGrplHcEVe8PjH553OT1Xu5V9bhg0,6
|
|
13
|
+
qwael-4.0.0.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|