Dataset Viewer
Auto-converted to Parquet Duplicate
text
stringlengths
0
578
[
"aichanstudio.xyz"
]
# comfy_generator.py
from concurrent.futures import ThreadPoolExecutor
import importlib
import subprocess
import sys
# ==============================
# Fungsi install dependensi otomatis
# ==============================
def install_dependencies():
required_packages = {
"websocket": "websocket-client",
"huggingface_hub": "huggingface-hub",
"pyminizip": "pyminizip"
}
for module_name, pip_name in required_packages.items():
try:
importlib.import_module(module_name)
except ImportError:
print(f"❌ Modul '{module_name}' tidak ditemukan. Menginstal '{pip_name}' ...")
subprocess.check_call([sys.executable, "-m", "pip", "install", pip_name])
install_dependencies()
import json
import os
import uuid
import datetime
import time
import io
import glob
import re
import shutil
import random
import urllib.request
import urllib.parse
import argparse
import requests
import zipfile
from PIL import Image, PngImagePlugin
from websocket import create_connection, WebSocketException
from huggingface_hub import HfApi, login, upload_file, hf_hub_download
from pathlib import Path
import pyminizip
COMFYUI_SERVER = "127.0.0.1:8188"
script_path = os.path.dirname(os.path.abspath(sys.argv[0]))
HF_API = "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"
VASTAI_API_KEY = "59675bddce0a08cf1d5309add929b552eb5126912803851c555ee21e1eeac573"
REPO_ID = "PapaRazi/vast-ai-private"
FILE_PASSWORD = "111000"
upload_executor = ThreadPoolExecutor(max_workers=4)
def is_online(server):
"""
Cek apakah server ComfyUI aktif via HTTP (lebih stabil daripada WS).
"""
try:
url = f"http://{server}/queue"
response = requests.get(url, timeout=2)
return True # asal bisa diakses, berarti online
except requests.RequestException:
return False
def get_open_button_token():
token = os.getenv("OPEN_BUTTON_TOKEN")
if not token:
return None
return token
OPEN_BUTTON_TOKEN = get_open_button_token()
def my_public_ip():
with open("Public_IP.json", "r", encoding="utf-8") as f:
data = json.load(f)
return data[0]
def upload_file(file_path):
ip_gayung = my_public_ip()
UPLOAD_URL = f"http://{ip_gayung}/upload_file"
if not os.path.isfile(file_path):
raise FileNotFoundError(f"File '{file_path}' tidak ditemukan")
with open(file_path, "rb") as f:
files = {"file": (os.path.basename(file_path), f)}
data = {"relative_path": file_path}
response = requests.post(UPLOAD_URL, files=files, data=data)
return response.status_code == 200
def normalize_relative_path(path: str) -> str:
path = path.replace("\\", "/")
if path.startswith("./"):
path = path[2:]
return path
def my_instance_id():
raw_instance = os.environ.get("VAST_CONTAINERLABEL") # misal "C.25862941" atau "A.123456"
if not raw_instance:
return None
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
16