File size: 825 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
# img_gen.py
#img_gen_modal.py
import modal
import os
import shutil


# Define the Modal image
image = (
    modal.Image.debian_slim(python_version="3.9")
    )

# Create a Modal app
app = modal.App("img-see-vol-data", image=image)
        
flux_model_vol = modal.Volume.from_name("flux-model-vol",create_if_missing=False)  # Reference your volume

@app.function(volumes={"/data": flux_model_vol}
              )
def main():
    
    # Define where to store the model
    download_model_name = "black-forest-labs/FLUX.1-dev"  # e.g., "stabilityai/stable-diffusion-2"
    local_dir = "data/FLUX.1-dev"


    model_path = "/data"
    if os.path.exists(model_path):
        print(f"Contents of {model_path}:")
        print(os.listdir(model_path))
    else:
        print(f"Model path {model_path} does not exist.")