Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,17 +4,16 @@ import gradio as gr
|
|
| 4 |
import numpy as np
|
| 5 |
from huggingface_hub.fastai_utils import from_pretrained_fastai
|
| 6 |
from fastai.vision.all import *
|
| 7 |
-
import matplotlib.pyplot as plt
|
| 8 |
from pathlib import Path
|
| 9 |
|
| 10 |
# ================================================
|
| 11 |
# STUBS FOR CUSTOM CLASSES / FUNCTIONS
|
| 12 |
-
# These match all custom classes used in the model
|
| 13 |
# ================================================
|
| 14 |
|
| 15 |
# Functions
|
| 16 |
def _inner(*args, **kwargs): return None
|
| 17 |
def style_loss(*args, **kwargs): return None
|
|
|
|
| 18 |
|
| 19 |
# Layers
|
| 20 |
class ReflectionLayer(nn.Module):
|
|
@@ -52,7 +51,7 @@ learner = from_pretrained_fastai(REPO_ID)
|
|
| 52 |
# ================================================
|
| 53 |
|
| 54 |
def infer(img):
|
| 55 |
-
#
|
| 56 |
if not isinstance(img, PILImage):
|
| 57 |
img = PILImage.create(img)
|
| 58 |
|
|
|
|
| 4 |
import numpy as np
|
| 5 |
from huggingface_hub.fastai_utils import from_pretrained_fastai
|
| 6 |
from fastai.vision.all import *
|
|
|
|
| 7 |
from pathlib import Path
|
| 8 |
|
| 9 |
# ================================================
|
| 10 |
# STUBS FOR CUSTOM CLASSES / FUNCTIONS
|
|
|
|
| 11 |
# ================================================
|
| 12 |
|
| 13 |
# Functions
|
| 14 |
def _inner(*args, **kwargs): return None
|
| 15 |
def style_loss(*args, **kwargs): return None
|
| 16 |
+
def act_loss(*args, **kwargs): return None
|
| 17 |
|
| 18 |
# Layers
|
| 19 |
class ReflectionLayer(nn.Module):
|
|
|
|
| 51 |
# ================================================
|
| 52 |
|
| 53 |
def infer(img):
|
| 54 |
+
# Convert to PILImage if needed
|
| 55 |
if not isinstance(img, PILImage):
|
| 56 |
img = PILImage.create(img)
|
| 57 |
|