test
Browse files
app.py
CHANGED
|
@@ -5,9 +5,7 @@ import glob
|
|
| 5 |
import matplotlib.pyplot as plt
|
| 6 |
import torch
|
| 7 |
import torchvision.transforms as T
|
| 8 |
-
from PIL import Image
|
| 9 |
import gradio as gr
|
| 10 |
-
from featup.util import norm, unnorm, pca, remove_axes
|
| 11 |
from pytorch_lightning import seed_everything
|
| 12 |
import os
|
| 13 |
import requests
|
|
@@ -16,6 +14,7 @@ import spaces
|
|
| 16 |
|
| 17 |
|
| 18 |
def plot_feats(image, lr, hr):
|
|
|
|
| 19 |
assert len(image.shape) == len(lr.shape) == len(hr.shape) == 3
|
| 20 |
seed_everything(0)
|
| 21 |
[lr_feats_pca, hr_feats_pca], _ = pca(
|
|
@@ -116,6 +115,7 @@ def upsample_features(image, model_option):
|
|
| 116 |
subprocess.check_call(
|
| 117 |
["pip", "install", "git+https://github.com/mhamilton723/FeatUp"])
|
| 118 |
|
|
|
|
| 119 |
models = {o: torch.hub.load("mhamilton723/FeatUp", o) for o in options}
|
| 120 |
|
| 121 |
# Image preprocessing
|
|
|
|
| 5 |
import matplotlib.pyplot as plt
|
| 6 |
import torch
|
| 7 |
import torchvision.transforms as T
|
|
|
|
| 8 |
import gradio as gr
|
|
|
|
| 9 |
from pytorch_lightning import seed_everything
|
| 10 |
import os
|
| 11 |
import requests
|
|
|
|
| 14 |
|
| 15 |
|
| 16 |
def plot_feats(image, lr, hr):
|
| 17 |
+
from featup.util import pca, remove_axes
|
| 18 |
assert len(image.shape) == len(lr.shape) == len(hr.shape) == 3
|
| 19 |
seed_everything(0)
|
| 20 |
[lr_feats_pca, hr_feats_pca], _ = pca(
|
|
|
|
| 115 |
subprocess.check_call(
|
| 116 |
["pip", "install", "git+https://github.com/mhamilton723/FeatUp"])
|
| 117 |
|
| 118 |
+
from featup.util import norm, unnorm
|
| 119 |
models = {o: torch.hub.load("mhamilton723/FeatUp", o) for o in options}
|
| 120 |
|
| 121 |
# Image preprocessing
|