import gradio as gr import os import time logs = [] def downloader(url, output_path, civitai_token): logs.clear() prompt = f"civitai-downloader --url={url} --output_path={output_path} --token={civitai_token}" os.system(prompt) logs.append(f"Download initiated! Check the output path: {output_path}") # Check if the downloaded file exists in the output path for _ in range(10): # retry for a certain amount of time time.sleep(1) # wait a bit before checking if os.path.exists(output_path): logs.append(f"File detected at: {output_path}") return "\n".join(logs), output_path # Return path for file output else: logs.append("Download complete, but file not detected in the specified output path.") return "\n".join(logs), None # Return None if file is not detected with gr.Blocks(theme='Ryouko-Yamanda65777/ryo', title="CivitAI Downloader") as app: gr.Markdown("