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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vhup
3
- Version: 1.2
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.2",
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.2
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.2/vhup/__init__.py DELETED
@@ -1,2 +0,0 @@
1
- from .vhup import create_text
2
- from .horba import create_loop
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
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes