vhup 1.2__tar.gz → 1.4__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.
- {vhup-1.2/vhup.egg-info → vhup-1.4}/PKG-INFO +1 -1
- {vhup-1.2 → vhup-1.4}/setup.py +1 -1
- vhup-1.4/vhup/__init__.py +1 -0
- {vhup-1.2 → vhup-1.4/vhup.egg-info}/PKG-INFO +1 -1
- {vhup-1.2 → vhup-1.4}/vhup.egg-info/SOURCES.txt +0 -1
- vhup-1.2/vhup/__init__.py +0 -2
- vhup-1.2/vhup/horba.py +0 -61
- {vhup-1.2 → vhup-1.4}/LICENSE +0 -0
- {vhup-1.2 → vhup-1.4}/README.md +0 -0
- {vhup-1.2 → vhup-1.4}/setup.cfg +0 -0
- {vhup-1.2 → vhup-1.4}/vhup/vhup.py +0 -0
- {vhup-1.2 → vhup-1.4}/vhup.egg-info/dependency_links.txt +0 -0
- {vhup-1.2 → vhup-1.4}/vhup.egg-info/requires.txt +0 -0
- {vhup-1.2 → vhup-1.4}/vhup.egg-info/top_level.txt +0 -0
{vhup-1.2 → vhup-1.4}/setup.py
RENAMED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .vhup import create_text
|
vhup-1.2/vhup/__init__.py
DELETED
vhup-1.2/vhup/horba.py
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import torch
|
|
2
|
-
import cv2
|
|
3
|
-
import numpy as np
|
|
4
|
-
import os
|
|
5
|
-
from PIL import Image
|
|
6
|
-
from diffusers import StableDiffusionControlNetPipeline, ControlNetModel, DPMSolverMultistepScheduler
|
|
7
|
-
from deep_translator import GoogleTranslator
|
|
8
|
-
|
|
9
|
-
# Donanım ayarları
|
|
10
|
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
11
|
-
dtype = torch.float16 if device == "cuda" else torch.float32
|
|
12
|
-
|
|
13
|
-
# 1. ControlNet ve Model Yükleme
|
|
14
|
-
controlnet = ControlNetModel.from_pretrained(
|
|
15
|
-
"lllyasviel/sd-controlnet-canny",
|
|
16
|
-
torch_dtype=dtype
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
_pipe = StableDiffusionControlNetPipeline.from_pretrained(
|
|
20
|
-
"runwayml/stable-diffusion-v1-5",
|
|
21
|
-
controlnet=controlnet,
|
|
22
|
-
torch_dtype=dtype,
|
|
23
|
-
safety_checker=None
|
|
24
|
-
).to(device)
|
|
25
|
-
|
|
26
|
-
_pipe.scheduler = DPMSolverMultistepScheduler.from_config(_pipe.scheduler.config)
|
|
27
|
-
translator = GoogleTranslator(source="tr", target="en")
|
|
28
|
-
|
|
29
|
-
def create_loop(prompt: str, foto: str) -> str:
|
|
30
|
-
# A. Referans Görsel İşleme (Canny Edge)
|
|
31
|
-
input_image = Image.open(foto).convert("RGB")
|
|
32
|
-
image_np = np.array(input_image)
|
|
33
|
-
|
|
34
|
-
# Kenar algılama ile iskelet çıkarma
|
|
35
|
-
image_canny = cv2.Canny(image_np, 100, 200)
|
|
36
|
-
image_canny = image_canny[:, :, None]
|
|
37
|
-
image_canny = np.concatenate([image_canny, image_canny, image_canny], axis=2)
|
|
38
|
-
canny_image = Image.fromarray(image_canny)
|
|
39
|
-
|
|
40
|
-
# B. Prompt Hazırlığı
|
|
41
|
-
# Türkçe giriş gelirse İngilizce'ye çevirir
|
|
42
|
-
translated_prompt = translator.translate(prompt)
|
|
43
|
-
|
|
44
|
-
# Kalite takıları (Quality Tags)
|
|
45
|
-
final_prompt = f"{translated_prompt}, highly detailed, masterpiece, 8k wallpaper"
|
|
46
|
-
negative_prompt = "lowres, bad anatomy, worst quality, blurry, deformed face"
|
|
47
|
-
|
|
48
|
-
# C. Üretim Süreci
|
|
49
|
-
output = _pipe(
|
|
50
|
-
prompt=final_prompt,
|
|
51
|
-
image=canny_image,
|
|
52
|
-
negative_prompt=negative_prompt,
|
|
53
|
-
num_inference_steps=30,
|
|
54
|
-
controlnet_conditioning_scale=0.7 # 0.7 referansa iyi sadık kalır ama yaratıcılığa da alan bırakır
|
|
55
|
-
).images[0]
|
|
56
|
-
|
|
57
|
-
# D. Kayıt
|
|
58
|
-
output_path = "vho_result.png"
|
|
59
|
-
output.save(output_path)
|
|
60
|
-
return os.path.abspath(output_path)
|
|
61
|
-
|
{vhup-1.2 → vhup-1.4}/LICENSE
RENAMED
|
File without changes
|
{vhup-1.2 → vhup-1.4}/README.md
RENAMED
|
File without changes
|
{vhup-1.2 → vhup-1.4}/setup.cfg
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|