mirror of
				https://github.com/Wan-Video/Wan2.1.git
				synced 2025-11-04 06:15:17 +00:00 
			
		
		
		
	updated mmgp version check
This commit is contained in:
		
							parent
							
								
									132aee82d8
								
							
						
					
					
						commit
						5b6b3f2832
					
				
							
								
								
									
										50
									
								
								wgp.py
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								wgp.py
									
									
									
									
									
								
							@ -40,7 +40,7 @@ global_queue_ref = []
 | 
			
		||||
AUTOSAVE_FILENAME = "queue.zip"
 | 
			
		||||
PROMPT_VARS_MAX = 10
 | 
			
		||||
 | 
			
		||||
target_mmgp_version = "3.3.4"
 | 
			
		||||
target_mmgp_version = "3.4.0"
 | 
			
		||||
from importlib.metadata import version
 | 
			
		||||
mmgp_version = version("mmgp")
 | 
			
		||||
if mmgp_version != target_mmgp_version:
 | 
			
		||||
@ -52,29 +52,29 @@ task_id = 0
 | 
			
		||||
# progress_tracker = {}
 | 
			
		||||
# tracker_lock = threading.Lock()
 | 
			
		||||
 | 
			
		||||
def download_ffmpeg():
 | 
			
		||||
    if os.name != 'nt': return
 | 
			
		||||
    exes = ['ffmpeg.exe', 'ffprobe.exe', 'ffplay.exe']
 | 
			
		||||
    if all(os.path.exists(e) for e in exes): return
 | 
			
		||||
    api_url = 'https://api.github.com/repos/GyanD/codexffmpeg/releases/latest'
 | 
			
		||||
    r = requests.get(api_url, headers={'Accept': 'application/vnd.github+json'})
 | 
			
		||||
    assets = r.json().get('assets', [])
 | 
			
		||||
    zip_asset = next((a for a in assets if 'essentials_build.zip' in a['name']), None)
 | 
			
		||||
    if not zip_asset: return
 | 
			
		||||
    zip_url = zip_asset['browser_download_url']
 | 
			
		||||
    zip_name = zip_asset['name']
 | 
			
		||||
    with requests.get(zip_url, stream=True) as resp:
 | 
			
		||||
        total = int(resp.headers.get('Content-Length', 0))
 | 
			
		||||
        with open(zip_name, 'wb') as f, tqdm(total=total, unit='B', unit_scale=True) as pbar:
 | 
			
		||||
            for chunk in resp.iter_content(chunk_size=8192):
 | 
			
		||||
                f.write(chunk)
 | 
			
		||||
                pbar.update(len(chunk))
 | 
			
		||||
    with zipfile.ZipFile(zip_name) as z:
 | 
			
		||||
        for f in z.namelist():
 | 
			
		||||
            if f.endswith(tuple(exes)) and '/bin/' in f:
 | 
			
		||||
                z.extract(f)
 | 
			
		||||
                os.rename(f, os.path.basename(f))
 | 
			
		||||
    os.remove(zip_name)
 | 
			
		||||
# def download_ffmpeg():
 | 
			
		||||
#     if os.name != 'nt': return
 | 
			
		||||
#     exes = ['ffmpeg.exe', 'ffprobe.exe', 'ffplay.exe']
 | 
			
		||||
#     if all(os.path.exists(e) for e in exes): return
 | 
			
		||||
#     api_url = 'https://api.github.com/repos/GyanD/codexffmpeg/releases/latest'
 | 
			
		||||
#     r = requests.get(api_url, headers={'Accept': 'application/vnd.github+json'})
 | 
			
		||||
#     assets = r.json().get('assets', [])
 | 
			
		||||
#     zip_asset = next((a for a in assets if 'essentials_build.zip' in a['name']), None)
 | 
			
		||||
#     if not zip_asset: return
 | 
			
		||||
#     zip_url = zip_asset['browser_download_url']
 | 
			
		||||
#     zip_name = zip_asset['name']
 | 
			
		||||
#     with requests.get(zip_url, stream=True) as resp:
 | 
			
		||||
#         total = int(resp.headers.get('Content-Length', 0))
 | 
			
		||||
#         with open(zip_name, 'wb') as f, tqdm(total=total, unit='B', unit_scale=True) as pbar:
 | 
			
		||||
#             for chunk in resp.iter_content(chunk_size=8192):
 | 
			
		||||
#                 f.write(chunk)
 | 
			
		||||
#                 pbar.update(len(chunk))
 | 
			
		||||
#     with zipfile.ZipFile(zip_name) as z:
 | 
			
		||||
#         for f in z.namelist():
 | 
			
		||||
#             if f.endswith(tuple(exes)) and '/bin/' in f:
 | 
			
		||||
#                 z.extract(f)
 | 
			
		||||
#                 os.rename(f, os.path.basename(f))
 | 
			
		||||
#     os.remove(zip_name)
 | 
			
		||||
 | 
			
		||||
def format_time(seconds):
 | 
			
		||||
    if seconds < 60:
 | 
			
		||||
@ -4676,7 +4676,7 @@ def create_demo():
 | 
			
		||||
 | 
			
		||||
if __name__ == "__main__":
 | 
			
		||||
    atexit.register(autosave_queue)
 | 
			
		||||
    download_ffmpeg()
 | 
			
		||||
    # download_ffmpeg()
 | 
			
		||||
    # threading.Thread(target=runner, daemon=True).start()
 | 
			
		||||
    os.environ["GRADIO_ANALYTICS_ENABLED"] = "False"
 | 
			
		||||
    server_port = int(args.server_port)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user