vhup 0.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.
- vhup/__init__.py +1 -0
- vhup/vhub.py +98 -0
- vhup-0.1.dist-info/METADATA +42 -0
- vhup-0.1.dist-info/RECORD +7 -0
- vhup-0.1.dist-info/WHEEL +5 -0
- vhup-0.1.dist-info/licenses/LICENSE +33 -0
- vhup-0.1.dist-info/top_level.txt +1 -0
vhup/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from vhup import create_text
|
vhup/vhub.py
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
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
|
+
FIXED_OUTPUT_FILE = "vho1.png"
|
|
12
|
+
|
|
13
|
+
TR_STYLE_MAP = {
|
|
14
|
+
"gerçekçi": "realistic",
|
|
15
|
+
"sinematik": "cinematic lighting",
|
|
16
|
+
"anime": "anime style",
|
|
17
|
+
"çizgi film": "cartoon style",
|
|
18
|
+
"karanlık": "dark dramatic mood",
|
|
19
|
+
"neon": "neon cyberpunk lighting",
|
|
20
|
+
"portre": "portrait photography",
|
|
21
|
+
"detaylı": "highly detailed",
|
|
22
|
+
"fantastik": "fantasy art",
|
|
23
|
+
"bilim kurgu": "science fiction",
|
|
24
|
+
"minimal": "minimalist composition"
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
QUALITY_LOCK = (
|
|
28
|
+
"masterpiece, ultra high quality, professional photography, "
|
|
29
|
+
"sharp focus, perfect lighting, high detail, clean composition"
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
NEGATIVE_LOCK = (
|
|
33
|
+
"worst quality, low quality, lowres, blurry, jpeg artifacts, "
|
|
34
|
+
"bad anatomy, bad proportions, extra fingers, missing fingers, "
|
|
35
|
+
"extra limbs, fused fingers, malformed hands, "
|
|
36
|
+
"deformed face, asymmetrical face, cross eye, lazy eye, "
|
|
37
|
+
"distorted body, mutated, ugly"
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
translator = GoogleTranslator(source="tr", target="en")
|
|
41
|
+
|
|
42
|
+
def _build_prompt(prompt_tr: str) -> str:
|
|
43
|
+
translated = translator.translate(prompt_tr)
|
|
44
|
+
prompt_lower = prompt_tr.lower()
|
|
45
|
+
styles = []
|
|
46
|
+
for tr, en in TR_STYLE_MAP.items():
|
|
47
|
+
if tr in prompt_lower:
|
|
48
|
+
styles.append(en)
|
|
49
|
+
|
|
50
|
+
parts = [translated]
|
|
51
|
+
if styles:
|
|
52
|
+
parts.append(", ".join(styles))
|
|
53
|
+
parts.append(QUALITY_LOCK)
|
|
54
|
+
return ", ".join(parts)
|
|
55
|
+
|
|
56
|
+
_pipe = StableDiffusionPipeline.from_pretrained(
|
|
57
|
+
"runwayml/stable-diffusion-v1-5",
|
|
58
|
+
torch_dtype=dtype,
|
|
59
|
+
safety_checker=None
|
|
60
|
+
).to(device)
|
|
61
|
+
|
|
62
|
+
_pipe.scheduler = DPMSolverMultistepScheduler.from_config(_pipe.scheduler.config)
|
|
63
|
+
_pipe.enable_attention_slicing()
|
|
64
|
+
|
|
65
|
+
def create_text(
|
|
66
|
+
prompt: str,
|
|
67
|
+
kalite: float = 7.5,
|
|
68
|
+
cfg: float = 7.5,
|
|
69
|
+
steps: int | None = None,
|
|
70
|
+
seed: int | None = None,
|
|
71
|
+
filename: str | None = None
|
|
72
|
+
) -> str:
|
|
73
|
+
final_prompt = _build_prompt(prompt)
|
|
74
|
+
|
|
75
|
+
if steps is None:
|
|
76
|
+
steps = int(20 + (kalite * 2))
|
|
77
|
+
|
|
78
|
+
if seed is None:
|
|
79
|
+
seed = random.randint(0, 999999999)
|
|
80
|
+
|
|
81
|
+
generator = torch.Generator(device=device).manual_seed(seed)
|
|
82
|
+
|
|
83
|
+
image = _pipe(
|
|
84
|
+
prompt=final_prompt,
|
|
85
|
+
negative_prompt=NEGATIVE_LOCK,
|
|
86
|
+
num_inference_steps=steps,
|
|
87
|
+
guidance_scale=float(cfg),
|
|
88
|
+
generator=generator
|
|
89
|
+
).images[0]
|
|
90
|
+
|
|
91
|
+
filename = FIXED_OUTPUT_FILE
|
|
92
|
+
|
|
93
|
+
if os.path.exists(filename):
|
|
94
|
+
os.remove(filename)
|
|
95
|
+
|
|
96
|
+
image.save(filename)
|
|
97
|
+
return os.path.abspath(filename)
|
|
98
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vhup
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Vho: İşlevsel ve kolaylaştırılmış görsel oluşturma kütüphanesi
|
|
5
|
+
Author: Bedirhan
|
|
6
|
+
Author-email: bedirhan.oytpass@gmail.com
|
|
7
|
+
License: MIT
|
|
8
|
+
Keywords: görsel,kolay,basitleştirilmiş
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: torch>=2.0.0
|
|
19
|
+
Requires-Dist: diffusers>=0.28.0
|
|
20
|
+
Requires-Dist: torchvision
|
|
21
|
+
Requires-Dist: controlnet-aux
|
|
22
|
+
Requires-Dist: opencv-python
|
|
23
|
+
Requires-Dist: transformers>=4.40.0
|
|
24
|
+
Requires-Dist: accelerate>=0.30.0
|
|
25
|
+
Requires-Dist: safetensors
|
|
26
|
+
Requires-Dist: imageio>=2.31.0
|
|
27
|
+
Requires-Dist: imageio-ffmpeg>=0.4.9
|
|
28
|
+
Requires-Dist: deep-translator
|
|
29
|
+
Requires-Dist: numpy
|
|
30
|
+
Requires-Dist: face_recognition
|
|
31
|
+
Requires-Dist: Pillow
|
|
32
|
+
Requires-Dist: insightface>=0.7.3
|
|
33
|
+
Requires-Dist: onnxruntime-gpu
|
|
34
|
+
Dynamic: author
|
|
35
|
+
Dynamic: author-email
|
|
36
|
+
Dynamic: classifier
|
|
37
|
+
Dynamic: description-content-type
|
|
38
|
+
Dynamic: keywords
|
|
39
|
+
Dynamic: license
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
Dynamic: requires-dist
|
|
42
|
+
Dynamic: summary
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
vhup/__init__.py,sha256=Y5ji22enaNGysXSk4uR3QCNsxRzUsWLeShPRPN1e-1Q,28
|
|
2
|
+
vhup/vhub.py,sha256=qe_nuVs3kVjtERVvhiBCJpFTKwvQ8lSW98zWSNc9rO4,2992
|
|
3
|
+
vhup-0.1.dist-info/licenses/LICENSE,sha256=JBFUrevjhAMgeCQTm9oayq-sPW-z5g6gQOe5V0oR-Gw,1825
|
|
4
|
+
vhup-0.1.dist-info/METADATA,sha256=jygJteKMHiiftkSoBhqkIQvDBagh9jOcUs9YgEfkgK4,1327
|
|
5
|
+
vhup-0.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
6
|
+
vhup-0.1.dist-info/top_level.txt,sha256=skPCN0-CD42vSTgGp13bImBTsHaeSzexy323JMm09uU,5
|
|
7
|
+
vhup-0.1.dist-info/RECORD,,
|
vhup-0.1.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bedirhan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "vhup"), known as
|
|
7
|
+
the vhup library and the vhup model, to deal in the Software without restriction,
|
|
8
|
+
including without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
10
|
+
persons to whom the Software is furnished to do so, subject to the following
|
|
11
|
+
conditions:
|
|
12
|
+
|
|
13
|
+
1. The above copyright notice and this permission notice shall be included in
|
|
14
|
+
all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
2. The Software is provided "as is", without warranty of any kind, express or
|
|
17
|
+
implied, including but not limited to the warranties of merchantability,
|
|
18
|
+
fitness for a particular purpose and noninfringement. In no event shall the
|
|
19
|
+
author be liable for any claim, damages or other liability, whether in an
|
|
20
|
+
action of contract, tort or otherwise, arising from, out of or in connection
|
|
21
|
+
with the Software or the use or other dealings in the Software.
|
|
22
|
+
|
|
23
|
+
3. The Software (vhup) and the underlying model (vhup) do not implement any
|
|
24
|
+
additional content filtering, moderation, or censorship mechanisms beyond
|
|
25
|
+
those inherently present in the underlying machine learning frameworks or
|
|
26
|
+
models used. All content generated using the Software is produced at the
|
|
27
|
+
sole discretion and responsibility of the user.
|
|
28
|
+
|
|
29
|
+
4. The author assumes no responsibility for the misuse of the Software or any
|
|
30
|
+
content generated through its use, including but not limited to illegal,
|
|
31
|
+
unethical, or harmful applications.
|
|
32
|
+
|
|
33
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vhup
|