Vho 0.2__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.
- vho-0.2.0/LICENSE +33 -0
- vho-0.2.0/PKG-INFO +78 -0
- vho-0.2.0/README.md +37 -0
- vho-0.2.0/Vho/__init__.py +3 -0
- vho-0.2.0/Vho/foto.py +91 -0
- vho-0.2.0/Vho/text.py +98 -0
- vho-0.2.0/Vho/video.py +155 -0
- vho-0.2.0/Vho.egg-info/PKG-INFO +78 -0
- vho-0.2.0/Vho.egg-info/SOURCES.txt +12 -0
- vho-0.2.0/Vho.egg-info/dependency_links.txt +1 -0
- vho-0.2.0/Vho.egg-info/requires.txt +13 -0
- vho-0.2.0/Vho.egg-info/top_level.txt +1 -0
- vho-0.2.0/setup.cfg +4 -0
- vho-0.2.0/setup.py +41 -0
vho-0.2.0/LICENSE
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 "Vho"), known as
|
|
7
|
+
the Vho library and the Vho1 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 (Vho) and the underlying model (Vho1) 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.
|
vho-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: Vho
|
|
3
|
+
Version: 0.2.0
|
|
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
|
|
19
|
+
Requires-Dist: diffusers>=0.24.0
|
|
20
|
+
Requires-Dist: torchvision
|
|
21
|
+
Requires-Dist: opencv-python
|
|
22
|
+
Requires-Dist: mediapipe==0.10.7
|
|
23
|
+
Requires-Dist: transformers>=4.35.0
|
|
24
|
+
Requires-Dist: accelerate>=0.25.0
|
|
25
|
+
Requires-Dist: safetensors>=0.4.0
|
|
26
|
+
Requires-Dist: imageio>=2.31.0
|
|
27
|
+
Requires-Dist: imageio-ffmpeg>=0.4.9
|
|
28
|
+
Requires-Dist: deep-translator>=1.11.4
|
|
29
|
+
Requires-Dist: numpy
|
|
30
|
+
Requires-Dist: Pillow
|
|
31
|
+
Dynamic: author
|
|
32
|
+
Dynamic: author-email
|
|
33
|
+
Dynamic: classifier
|
|
34
|
+
Dynamic: description
|
|
35
|
+
Dynamic: description-content-type
|
|
36
|
+
Dynamic: keywords
|
|
37
|
+
Dynamic: license
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
Dynamic: requires-dist
|
|
40
|
+
Dynamic: summary
|
|
41
|
+
|
|
42
|
+
# Vho1
|
|
43
|
+
|
|
44
|
+
**Vho1**, Türkçe prompt kullanarak **yüksek kaliteli, profesyonel Stable Diffusion görselleri**
|
|
45
|
+
üretmeyi kolaylaştıran bir Python kütüphanesidir.
|
|
46
|
+
|
|
47
|
+
Kullanıcıyı prompt mühendisliğiyle uğraştırmaz; Türkçe yazılan ifadeleri otomatik olarak
|
|
48
|
+
**AI’ye uygun profesyonel promptlara** dönüştürür.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 🚀 Ne İçin Yapıldı?
|
|
53
|
+
|
|
54
|
+
- Türkçe bilen ama prompt mühendisliği bilmeyen kullanıcılar için
|
|
55
|
+
- Stable Diffusion’dan **daha temiz, daha az kusurlu** görseller almak için
|
|
56
|
+
- Tek fonksiyonla, sade bir API ile görsel üretmek için
|
|
57
|
+
- API, kota veya harici servis kullanmadan **tam kontrol** sağlamak için
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 🔓 Sansür Durumu
|
|
62
|
+
|
|
63
|
+
Bu kütüphane:
|
|
64
|
+
|
|
65
|
+
- Stable Diffusion **safety checker’ını kapatır**
|
|
66
|
+
- Ek bir filtre veya sansür uygulamaz
|
|
67
|
+
- Görsel üretim üzerinde **tam kontrolü kullanıcıya bırakır**
|
|
68
|
+
|
|
69
|
+
> Not: Üretilen içeriklerin sorumluluğu tamamen kullanıcıya aittir.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 📦 Kurulum
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pip install Vho
|
|
77
|
+
|
|
78
|
+
|
vho-0.2.0/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Vho1
|
|
2
|
+
|
|
3
|
+
**Vho1**, Türkçe prompt kullanarak **yüksek kaliteli, profesyonel Stable Diffusion görselleri**
|
|
4
|
+
üretmeyi kolaylaştıran bir Python kütüphanesidir.
|
|
5
|
+
|
|
6
|
+
Kullanıcıyı prompt mühendisliğiyle uğraştırmaz; Türkçe yazılan ifadeleri otomatik olarak
|
|
7
|
+
**AI’ye uygun profesyonel promptlara** dönüştürür.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 🚀 Ne İçin Yapıldı?
|
|
12
|
+
|
|
13
|
+
- Türkçe bilen ama prompt mühendisliği bilmeyen kullanıcılar için
|
|
14
|
+
- Stable Diffusion’dan **daha temiz, daha az kusurlu** görseller almak için
|
|
15
|
+
- Tek fonksiyonla, sade bir API ile görsel üretmek için
|
|
16
|
+
- API, kota veya harici servis kullanmadan **tam kontrol** sağlamak için
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 🔓 Sansür Durumu
|
|
21
|
+
|
|
22
|
+
Bu kütüphane:
|
|
23
|
+
|
|
24
|
+
- Stable Diffusion **safety checker’ını kapatır**
|
|
25
|
+
- Ek bir filtre veya sansür uygulamaz
|
|
26
|
+
- Görsel üretim üzerinde **tam kontrolü kullanıcıya bırakır**
|
|
27
|
+
|
|
28
|
+
> Not: Üretilen içeriklerin sorumluluğu tamamen kullanıcıya aittir.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 📦 Kurulum
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install Vho
|
|
36
|
+
|
|
37
|
+
|
vho-0.2.0/Vho/foto.py
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import cv2
|
|
3
|
+
import torch
|
|
4
|
+
import numpy as np
|
|
5
|
+
from PIL import Image
|
|
6
|
+
import mediapipe as mp
|
|
7
|
+
from diffusers import StableDiffusionInpaintPipeline, DPMSolverMultistepScheduler
|
|
8
|
+
|
|
9
|
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
10
|
+
dtype = torch.float16 if device == "cuda" else torch.float32
|
|
11
|
+
|
|
12
|
+
OUTPUT_FILE = "vho_pro.png"
|
|
13
|
+
|
|
14
|
+
NEGATIVE_PROMPT = (
|
|
15
|
+
"worst quality, low quality, lowres, blurry, jpeg artifacts, "
|
|
16
|
+
"bad anatomy, bad proportions, extra fingers, missing fingers, "
|
|
17
|
+
"extra limbs, fused fingers, malformed hands, "
|
|
18
|
+
"deformed face, distorted face, asymmetrical face, "
|
|
19
|
+
"mutated, ugly"
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
def create_face_mask(image_path: str, mask_path: str = "face_mask.png") -> str:
|
|
23
|
+
mp_face = mp.solutions.face_mesh.FaceMesh(static_image_mode=True)
|
|
24
|
+
img = cv2.imread(image_path)
|
|
25
|
+
|
|
26
|
+
if img is None:
|
|
27
|
+
raise FileNotFoundError("Görsel okunamadı")
|
|
28
|
+
|
|
29
|
+
h, w, _ = img.shape
|
|
30
|
+
rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
|
31
|
+
res = mp_face.process(rgb)
|
|
32
|
+
|
|
33
|
+
mask = np.ones((h, w), dtype=np.uint8) * 255
|
|
34
|
+
|
|
35
|
+
if res.multi_face_landmarks:
|
|
36
|
+
for face in res.multi_face_landmarks:
|
|
37
|
+
points = []
|
|
38
|
+
for lm in face.landmark:
|
|
39
|
+
points.append((int(lm.x * w), int(lm.y * h)))
|
|
40
|
+
hull = cv2.convexHull(np.array(points))
|
|
41
|
+
cv2.fillConvexPoly(mask, hull, 0)
|
|
42
|
+
|
|
43
|
+
Image.fromarray(mask).save(mask_path)
|
|
44
|
+
return mask_path
|
|
45
|
+
|
|
46
|
+
pipe = StableDiffusionInpaintPipeline.from_pretrained(
|
|
47
|
+
"runwayml/stable-diffusion-v1-5",
|
|
48
|
+
dtype=dtype,
|
|
49
|
+
safety_checker=None
|
|
50
|
+
).to(device)
|
|
51
|
+
|
|
52
|
+
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
|
|
53
|
+
pipe.enable_attention_slicing()
|
|
54
|
+
|
|
55
|
+
def create_foto(
|
|
56
|
+
foto: str,
|
|
57
|
+
prompt: str,
|
|
58
|
+
strength: float = 0.75,
|
|
59
|
+
cfg: float = 6.5,
|
|
60
|
+
steps: int = 35,
|
|
61
|
+
output: str = OUTPUT_FILE
|
|
62
|
+
) -> str:
|
|
63
|
+
if not os.path.exists(foto):
|
|
64
|
+
raise FileNotFoundError("Görsel bulunamadı")
|
|
65
|
+
|
|
66
|
+
mask_path = create_face_mask(foto)
|
|
67
|
+
|
|
68
|
+
image = Image.open(foto).convert("RGB")
|
|
69
|
+
mask = Image.open(mask_path).convert("L")
|
|
70
|
+
|
|
71
|
+
final_prompt = (
|
|
72
|
+
prompt
|
|
73
|
+
+ ", ultra realistic, professional portrait, cinematic lighting, "
|
|
74
|
+
+ "sharp focus, high detail, natural skin texture"
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
result = pipe(
|
|
78
|
+
prompt=final_prompt,
|
|
79
|
+
negative_prompt=NEGATIVE_PROMPT,
|
|
80
|
+
image=image,
|
|
81
|
+
mask_image=mask,
|
|
82
|
+
strength=strength,
|
|
83
|
+
guidance_scale=cfg,
|
|
84
|
+
num_inference_steps=steps
|
|
85
|
+
).images[0]
|
|
86
|
+
|
|
87
|
+
if os.path.exists(output):
|
|
88
|
+
os.remove(output)
|
|
89
|
+
|
|
90
|
+
result.save(output)
|
|
91
|
+
return os.path.abspath(output)
|
vho-0.2.0/Vho/text.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
|
+
|
vho-0.2.0/Vho/video.py
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import random
|
|
3
|
+
import logging
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import Optional
|
|
6
|
+
|
|
7
|
+
import torch
|
|
8
|
+
import imageio
|
|
9
|
+
from diffusers import AnimateDiffPipeline, DPMSolverMultistepScheduler, MotionAdapter
|
|
10
|
+
from deep_translator import GoogleTranslator
|
|
11
|
+
|
|
12
|
+
logging.basicConfig(
|
|
13
|
+
level=logging.INFO,
|
|
14
|
+
format="%(asctime)s | %(levelname)s | %(message)s"
|
|
15
|
+
)
|
|
16
|
+
logger = logging.getLogger("videogen")
|
|
17
|
+
|
|
18
|
+
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
|
19
|
+
DTYPE = torch.float16 if DEVICE == "cuda" else torch.float32
|
|
20
|
+
|
|
21
|
+
TR_STYLE_MAP = {
|
|
22
|
+
"gerçekçi": "realistic",
|
|
23
|
+
"sinematik": "cinematic lighting",
|
|
24
|
+
"anime": "anime style",
|
|
25
|
+
"çizgi film": "cartoon style",
|
|
26
|
+
"karanlık": "dark dramatic mood",
|
|
27
|
+
"neon": "neon cyberpunk lighting",
|
|
28
|
+
"portre": "portrait photography",
|
|
29
|
+
"detaylı": "highly detailed",
|
|
30
|
+
"fantastik": "fantasy art",
|
|
31
|
+
"bilim kurgu": "science fiction",
|
|
32
|
+
"minimal": "minimalist composition",
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
QUALITY_LOCK = (
|
|
36
|
+
"masterpiece, ultra high quality, professional cinematic visuals, "
|
|
37
|
+
"sharp focus, perfect lighting, high detail"
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
NEGATIVE_LOCK = (
|
|
41
|
+
"worst quality, low quality, lowres, blurry, jpeg artifacts, "
|
|
42
|
+
"bad anatomy, bad proportions, extra fingers, missing fingers, "
|
|
43
|
+
"extra limbs, fused fingers, malformed hands, "
|
|
44
|
+
"deformed face, asymmetrical face, cross eye, lazy eye, "
|
|
45
|
+
"distorted body, mutated, ugly"
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
translator = GoogleTranslator(source="tr", target="en")
|
|
49
|
+
|
|
50
|
+
@dataclass
|
|
51
|
+
class VideoConfig:
|
|
52
|
+
fps: int = 8
|
|
53
|
+
num_frames: int = 24
|
|
54
|
+
kalite: float = 7.5
|
|
55
|
+
cfg: float = 7.5
|
|
56
|
+
seed: Optional[int] = None
|
|
57
|
+
filename: str = "output.mp4"
|
|
58
|
+
|
|
59
|
+
class PromptBuilder:
|
|
60
|
+
@staticmethod
|
|
61
|
+
def build(prompt_tr: str) -> str:
|
|
62
|
+
translated = translator.translate(prompt_tr)
|
|
63
|
+
prompt_lower = prompt_tr.lower()
|
|
64
|
+
styles = [
|
|
65
|
+
en for tr, en in TR_STYLE_MAP.items()
|
|
66
|
+
if tr in prompt_lower
|
|
67
|
+
]
|
|
68
|
+
parts = [translated]
|
|
69
|
+
if styles:
|
|
70
|
+
parts.append(", ".join(styles))
|
|
71
|
+
parts.append(QUALITY_LOCK)
|
|
72
|
+
final_prompt = ", ".join(parts)
|
|
73
|
+
logger.debug(final_prompt)
|
|
74
|
+
return final_prompt
|
|
75
|
+
|
|
76
|
+
class AnimateDiffVideoGenerator:
|
|
77
|
+
_pipe = None
|
|
78
|
+
|
|
79
|
+
def __init__(self):
|
|
80
|
+
self.device = DEVICE
|
|
81
|
+
self.dtype = DTYPE
|
|
82
|
+
|
|
83
|
+
def _load_pipe(self):
|
|
84
|
+
if AnimateDiffVideoGenerator._pipe is not None:
|
|
85
|
+
return AnimateDiffVideoGenerator._pipe
|
|
86
|
+
|
|
87
|
+
motion_adapter = MotionAdapter.from_pretrained(
|
|
88
|
+
"guoyww/animatediff-motion-adapter-v1-5",
|
|
89
|
+
torch_dtype=self.dtype
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
pipe = AnimateDiffPipeline.from_pretrained(
|
|
93
|
+
"runwayml/stable-diffusion-v1-5",
|
|
94
|
+
motion_adapter=motion_adapter,
|
|
95
|
+
torch_dtype=self.dtype,
|
|
96
|
+
safety_checker=None
|
|
97
|
+
).to(self.device)
|
|
98
|
+
|
|
99
|
+
pipe.scheduler = DPMSolverMultistepScheduler.from_config(
|
|
100
|
+
pipe.scheduler.config
|
|
101
|
+
)
|
|
102
|
+
pipe.enable_attention_slicing()
|
|
103
|
+
|
|
104
|
+
AnimateDiffVideoGenerator._pipe = pipe
|
|
105
|
+
return pipe
|
|
106
|
+
|
|
107
|
+
def generate(self, prompt: str, config: VideoConfig) -> str:
|
|
108
|
+
pipe = self._load_pipe()
|
|
109
|
+
|
|
110
|
+
seed = config.seed or random.randint(0, 999_999_999)
|
|
111
|
+
generator = torch.Generator(device=self.device).manual_seed(seed)
|
|
112
|
+
|
|
113
|
+
steps = int(20 + (config.kalite * 2))
|
|
114
|
+
final_prompt = PromptBuilder.build(prompt)
|
|
115
|
+
|
|
116
|
+
result = pipe(
|
|
117
|
+
prompt=final_prompt,
|
|
118
|
+
negative_prompt=NEGATIVE_LOCK,
|
|
119
|
+
num_frames=config.num_frames,
|
|
120
|
+
num_inference_steps=steps,
|
|
121
|
+
guidance_scale=float(config.cfg),
|
|
122
|
+
generator=generator
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
frames = result.frames[0]
|
|
126
|
+
|
|
127
|
+
imageio.mimsave(
|
|
128
|
+
config.filename,
|
|
129
|
+
frames,
|
|
130
|
+
fps=config.fps,
|
|
131
|
+
codec="libx264",
|
|
132
|
+
quality=8
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
return os.path.abspath(config.filename)
|
|
136
|
+
|
|
137
|
+
def create_video(
|
|
138
|
+
prompt: str,
|
|
139
|
+
fps: int = 8,
|
|
140
|
+
kalite: float = 7.5,
|
|
141
|
+
cfg: float = 7.5,
|
|
142
|
+
seed: Optional[int] = None,
|
|
143
|
+
filename: str = "video.mp4"
|
|
144
|
+
) -> str:
|
|
145
|
+
config = VideoConfig(
|
|
146
|
+
fps=fps,
|
|
147
|
+
kalite=kalite,
|
|
148
|
+
cfg=cfg,
|
|
149
|
+
seed=seed,
|
|
150
|
+
filename=filename
|
|
151
|
+
)
|
|
152
|
+
generator = AnimateDiffVideoGenerator()
|
|
153
|
+
return generator.generate(prompt, config)
|
|
154
|
+
|
|
155
|
+
__all__ = ["create_video", "VideoConfig"]
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: Vho
|
|
3
|
+
Version: 0.2.0
|
|
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
|
|
19
|
+
Requires-Dist: diffusers>=0.24.0
|
|
20
|
+
Requires-Dist: torchvision
|
|
21
|
+
Requires-Dist: opencv-python
|
|
22
|
+
Requires-Dist: mediapipe==0.10.7
|
|
23
|
+
Requires-Dist: transformers>=4.35.0
|
|
24
|
+
Requires-Dist: accelerate>=0.25.0
|
|
25
|
+
Requires-Dist: safetensors>=0.4.0
|
|
26
|
+
Requires-Dist: imageio>=2.31.0
|
|
27
|
+
Requires-Dist: imageio-ffmpeg>=0.4.9
|
|
28
|
+
Requires-Dist: deep-translator>=1.11.4
|
|
29
|
+
Requires-Dist: numpy
|
|
30
|
+
Requires-Dist: Pillow
|
|
31
|
+
Dynamic: author
|
|
32
|
+
Dynamic: author-email
|
|
33
|
+
Dynamic: classifier
|
|
34
|
+
Dynamic: description
|
|
35
|
+
Dynamic: description-content-type
|
|
36
|
+
Dynamic: keywords
|
|
37
|
+
Dynamic: license
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
Dynamic: requires-dist
|
|
40
|
+
Dynamic: summary
|
|
41
|
+
|
|
42
|
+
# Vho1
|
|
43
|
+
|
|
44
|
+
**Vho1**, Türkçe prompt kullanarak **yüksek kaliteli, profesyonel Stable Diffusion görselleri**
|
|
45
|
+
üretmeyi kolaylaştıran bir Python kütüphanesidir.
|
|
46
|
+
|
|
47
|
+
Kullanıcıyı prompt mühendisliğiyle uğraştırmaz; Türkçe yazılan ifadeleri otomatik olarak
|
|
48
|
+
**AI’ye uygun profesyonel promptlara** dönüştürür.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 🚀 Ne İçin Yapıldı?
|
|
53
|
+
|
|
54
|
+
- Türkçe bilen ama prompt mühendisliği bilmeyen kullanıcılar için
|
|
55
|
+
- Stable Diffusion’dan **daha temiz, daha az kusurlu** görseller almak için
|
|
56
|
+
- Tek fonksiyonla, sade bir API ile görsel üretmek için
|
|
57
|
+
- API, kota veya harici servis kullanmadan **tam kontrol** sağlamak için
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 🔓 Sansür Durumu
|
|
62
|
+
|
|
63
|
+
Bu kütüphane:
|
|
64
|
+
|
|
65
|
+
- Stable Diffusion **safety checker’ını kapatır**
|
|
66
|
+
- Ek bir filtre veya sansür uygulamaz
|
|
67
|
+
- Görsel üretim üzerinde **tam kontrolü kullanıcıya bırakır**
|
|
68
|
+
|
|
69
|
+
> Not: Üretilen içeriklerin sorumluluğu tamamen kullanıcıya aittir.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 📦 Kurulum
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pip install Vho
|
|
77
|
+
|
|
78
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Vho
|
vho-0.2.0/setup.cfg
ADDED
vho-0.2.0/setup.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
with open("README.md", "r", encoding="utf-8") as f:
|
|
4
|
+
README = f.read()
|
|
5
|
+
|
|
6
|
+
setup(
|
|
7
|
+
name="Vho",
|
|
8
|
+
version="0.2.0",
|
|
9
|
+
packages=find_packages(),
|
|
10
|
+
install_requires=[
|
|
11
|
+
"torch",
|
|
12
|
+
"diffusers>=0.24.0",
|
|
13
|
+
"torchvision",
|
|
14
|
+
"opencv-python",
|
|
15
|
+
"mediapipe==0.10.7",
|
|
16
|
+
"transformers>=4.35.0",
|
|
17
|
+
"accelerate>=0.25.0",
|
|
18
|
+
"safetensors>=0.4.0",
|
|
19
|
+
"imageio>=2.31.0",
|
|
20
|
+
"imageio-ffmpeg>=0.4.9",
|
|
21
|
+
"deep-translator>=1.11.4",
|
|
22
|
+
"numpy",
|
|
23
|
+
"Pillow"
|
|
24
|
+
],
|
|
25
|
+
description="Vho: İşlevsel ve kolaylaştırılmış görsel oluşturma kütüphanesi",
|
|
26
|
+
long_description=README,
|
|
27
|
+
long_description_content_type="text/markdown",
|
|
28
|
+
author="Bedirhan",
|
|
29
|
+
author_email="bedirhan.oytpass@gmail.com",
|
|
30
|
+
license="MIT",
|
|
31
|
+
keywords=["görsel", "kolay", "basitleştirilmiş"],
|
|
32
|
+
classifiers=[
|
|
33
|
+
"License :: OSI Approved :: MIT License",
|
|
34
|
+
"Programming Language :: Python :: 3",
|
|
35
|
+
"Programming Language :: Python :: 3.6",
|
|
36
|
+
"Programming Language :: Python :: 3.7",
|
|
37
|
+
"Programming Language :: Python :: 3.8",
|
|
38
|
+
"Programming Language :: Python :: 3.9",
|
|
39
|
+
"Programming Language :: Python :: 3.10"
|
|
40
|
+
],
|
|
41
|
+
)
|