vhup 1.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vhup
3
- Version: 1.3
3
+ Version: 1.4
4
4
  Summary: Vho: İşlevsel ve kolaylaştırılmış görsel oluşturma kütüphanesi
5
5
  Author: Bedirhan
6
6
  Author-email: bedirhan.oytpass@gmail.com
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as f:
5
5
 
6
6
  setup(
7
7
  name="vhup",
8
- version="1.3",
8
+ version="1.4",
9
9
  packages=find_packages(),
10
10
  install_requires=[
11
11
  "torch>=2.0.0",
@@ -0,0 +1 @@
1
+ from .vhup import create_text
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vhup
3
- Version: 1.3
3
+ Version: 1.4
4
4
  Summary: Vho: İşlevsel ve kolaylaştırılmış görsel oluşturma kütüphanesi
5
5
  Author: Bedirhan
6
6
  Author-email: bedirhan.oytpass@gmail.com
@@ -2,7 +2,6 @@ LICENSE
2
2
  README.md
3
3
  setup.py
4
4
  vhup/__init__.py
5
- vhup/horba.py
6
5
  vhup/vhup.py
7
6
  vhup.egg-info/PKG-INFO
8
7
  vhup.egg-info/SOURCES.txt
vhup-1.3/vhup/__init__.py DELETED
@@ -1,2 +0,0 @@
1
- from .vhup import create_text
2
- from .horba import create_loop
vhup-1.3/vhup/horba.py DELETED
@@ -1,83 +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
- from gfpgan import GFPGANer # Yüz düzelticiyi ekledik
9
-
10
- # Donanım ayarları
11
- device = "cuda" if torch.cuda.is_available() else "cpu"
12
- dtype = torch.float16 if device == "cuda" else torch.float32
13
-
14
- # 1. Yüz Düzelticiyi Başlat (Kodu bozmaz, sadece üretim sonrası devreye girer)
15
- face_enhancer = GFPGANer(
16
- model_path='https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth',
17
- upscale=1,
18
- arch='clean',
19
- channel_multiplier=2,
20
- device=device
21
- )
22
-
23
- # 2. ControlNet ve Model Yükleme
24
- controlnet = ControlNetModel.from_pretrained(
25
- "lllyasviel/sd-controlnet-canny",
26
- torch_dtype=dtype
27
- )
28
-
29
- _pipe = StableDiffusionControlNetPipeline.from_pretrained(
30
- "runwayml/stable-diffusion-v1-5",
31
- controlnet=controlnet,
32
- torch_dtype=dtype,
33
- safety_checker=None
34
- ).to(device)
35
-
36
- _pipe.scheduler = DPMSolverMultistepScheduler.from_config(_pipe.scheduler.config)
37
- translator = GoogleTranslator(source="tr", target="en")
38
-
39
- def create_loop(prompt: str, foto: str) -> str:
40
- # A. Referans Görsel İşleme
41
- input_image = Image.open(foto).convert("RGB")
42
- image_np = np.array(input_image)
43
-
44
- image_canny = cv2.Canny(image_np, 100, 200)
45
- image_canny = image_canny[:, :, None]
46
- image_canny = np.concatenate([image_canny, image_canny, image_canny], axis=2)
47
- canny_image = Image.fromarray(image_canny)
48
-
49
- # B. Prompt Hazırlığı
50
- translated_prompt = translator.translate(prompt)
51
- final_prompt = f"{translated_prompt}, highly detailed, masterpiece, 8k wallpaper"
52
- negative_prompt = "lowres, bad anatomy, worst quality, blurry, deformed face"
53
-
54
- # C. Üretim Süreci
55
- output_raw = _pipe(
56
- prompt=final_prompt,
57
- image=canny_image,
58
- negative_prompt=negative_prompt,
59
- num_inference_steps=30,
60
- controlnet_conditioning_scale=0.7
61
- ).images[0]
62
-
63
- # --- YÜZ DÜZELTME (Sistemi bozmadan eklenen katman) ---
64
- # PIL görselini OpenCV formatına çevir
65
- open_cv_image = cv2.cvtColor(np.array(output_raw), cv2.COLOR_RGB2BGR)
66
-
67
- # GFPGAN ile yüzü işle
68
- _, _, restored_img = face_enhancer.enhance(
69
- open_cv_image,
70
- has_aligned=False,
71
- only_center_face=False,
72
- paste_back=True
73
- )
74
-
75
- # Sonucu tekrar PIL formatına döndür
76
- final_image = Image.fromarray(cv2.cvtColor(restored_img, cv2.COLOR_BGR2RGB))
77
- # ---------------------------------------------------
78
-
79
- # D. Kayıt
80
- output_path = "vho_result.png"
81
- final_image.save(output_path)
82
- return os.path.abspath(output_path)
83
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes