Spaces:
Sleeping
Sleeping
File size: 1,826 Bytes
4f48282 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
from src.gradio_interface import demo
import modal
# Define the Modal image
image = (
modal.Image.from_registry(
"nvidia/cuda:12.2.0-devel-ubuntu22.04", add_python="3.11"
)
.pip_install(
"ninja",
"packaging",
"wheel",
"diffusers", # For Stable Diffusion
"transformers", # For Hugging Face models
"torch>=2.0.1", # PyTorch with a minimum version
"accelerate", # For distributed training/inference
"gradio", # For the Gradio interface
"safetensors", # For safe model loading
"pillow", # For image processing
"datasets", # For datasets (if needed)
)
)
# Create a Modal app
app = modal.App("ctb-image-generator", image=image)
# Debug function to check installed packages
def check_dependencies():
import importlib
packages = [
"diffusers", # For Stable Diffusion
"transformers", # For Hugging Face models
"torch", # PyTorch
"accelerate", # For distributed training/inference
"gradio>=4.44.1", # For the Gradio interface (updated to latest version)
"safetensors", # For safe model loading
"pillow", # For image processing
]
for package in packages:
try:
module = importlib.import_module(package)
print(f"✅ {package} is installed. Version: {module.__version__}")
except ImportError:
print(f"❌ {package} is NOT installed.")
@app.local_entrypoint()
def main():
print("🚀 Starting Modal app...")
with modal.enable_output():
print("🔍 Running debug check...")
check_dependencies()
print("🎨 Launching Gradio interface...")
demo.launch()
with modal.enable_output():
demo.launch()
if __name__ == "__main__":
main() |