Spaces:
Configuration error
Configuration error
Download App.Py from Sinadavinc80/Lithix: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/spaces/Sinadavinc80/Lithix/resolve/main/App.Py
- Command line
-
hf download hf://spaces/Sinadavinc80/Lithix/App.Py
-
curl -L -o App.Py https://huggingface.co/spaces/Sinadavinc80/Lithix/resolve/main/App.Py
1.1 kB
| import gradio as gr | |
| from diffusers import StableDiffusionPipeline | |
| import torch | |
| # بارگذاری مدل (qwen_3.5_4b_i8x) | |
| pipe = StableDiffusionPipeline.from_ckpt( | |
| "/path/to/On My iPhone ▸ Draw Things ▸ Models", # .ckpt | |
| torch_dtype=torch.float32, # float16 CPU | |
| use_safetensors=True | |
| ) | |
| pipe = pipe.to("cpu") # CPU | |
| def generate(prompt, negative_prompt="", steps=20, guidance=7.5): | |
| image = pipe( | |
| prompt, | |
| negative_prompt=negative_prompt, | |
| num_inference_steps=steps, | |
| guidance_scale=guidance | |
| ).images[0] | |
| return image | |
| iface = gr.Interface( | |
| fn=generate, | |
| inputs=[ | |
| gr.Textbox(label="پرامپت"), | |
| gr.Textbox(label="پرامپت منفی", value=""), | |
| gr.Slider(5, 50, value=20, label="Steps"), | |
| gr.Slider(1, 15, value=7.5, label="Guidance Scale") | |
| ], | |
| outputs=gr.Image(label="نتیجه"), | |
| title="AI Video/Image Generator محلی", | |
| description="کاملاً آفلاین - مدل .ckpt" | |
| ) | |
| iface.launch(server_name="127.0.0.1", server_port=7860, share=true) |