Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,3 @@
|
|
1 |
-
# -*- coding: utf-8 -*-
|
2 |
-
"""SDXL-SAM.ipynb
|
3 |
-
|
4 |
-
Automatically generated by Colaboratory.
|
5 |
-
|
6 |
-
Original file is located at
|
7 |
-
https://colab.research.google.com/github/pranavsrinivasa/SDXL-SAM-HEADSHOT-CREATOR/blob/main/SDXL-SAM.ipynb
|
8 |
-
"""
|
9 |
-
|
10 |
-
!pip install diffusers
|
11 |
-
!pip install transformers
|
12 |
|
13 |
from diffusers import StableDiffusionInpaintPipeline
|
14 |
import torch
|
@@ -17,20 +6,6 @@ model_id = 'stabilityai/stable-diffusion-2-inpainting'
|
|
17 |
sd_pipeline = StableDiffusionInpaintPipeline.from_pretrained(model_id,torch_dtype = torch.float16)
|
18 |
sd_pipeline = sd_pipeline.to("cuda")
|
19 |
|
20 |
-
!pip install gradio==3.48.0
|
21 |
-
|
22 |
-
!pip install -q 'git+https://github.com/facebookresearch/segment-anything.git'
|
23 |
-
!pip install -q jupyter_bbox_widget roboflow dataclasses-json supervision
|
24 |
-
|
25 |
-
!mkdir -p {HOME}/weights
|
26 |
-
!wget -q https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth -P {HOME}/weights
|
27 |
-
|
28 |
-
import os
|
29 |
-
|
30 |
-
CHECKPOINT_PATH = os.path.join("{HOME}", "weights", "sam_vit_h_4b8939.pth")
|
31 |
-
print(CHECKPOINT_PATH, "; exist:", os.path.isfile(CHECKPOINT_PATH))
|
32 |
-
MODEL_TYPE = "vit_h"
|
33 |
-
|
34 |
from segment_anything import sam_model_registry, SamAutomaticMaskGenerator, SamPredictor
|
35 |
|
36 |
sam = sam_model_registry[MODEL_TYPE](checkpoint=CHECKPOINT_PATH).to("cuda")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
|
2 |
from diffusers import StableDiffusionInpaintPipeline
|
3 |
import torch
|
|
|
6 |
sd_pipeline = StableDiffusionInpaintPipeline.from_pretrained(model_id,torch_dtype = torch.float16)
|
7 |
sd_pipeline = sd_pipeline.to("cuda")
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
from segment_anything import sam_model_registry, SamAutomaticMaskGenerator, SamPredictor
|
10 |
|
11 |
sam = sam_model_registry[MODEL_TYPE](checkpoint=CHECKPOINT_PATH).to("cuda")
|