Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,9 @@ import shinyswatch
|
|
8 |
|
9 |
from shiny import App, Inputs, Outputs, Session, reactive, render, req, ui
|
10 |
|
|
|
|
|
|
|
11 |
from transformers import SamModel, SamConfig, SamProcessor
|
12 |
import torch
|
13 |
|
@@ -80,8 +83,6 @@ def server(input: Inputs, output: Outputs, session: Session):
|
|
80 |
@render.image
|
81 |
def uploaded_image():
|
82 |
"""Displays the uploaded image"""
|
83 |
-
from pathlib import Path
|
84 |
-
|
85 |
img_src = uploaded_image_path()
|
86 |
if img_src:
|
87 |
dir = Path(__file__).resolve().parent
|
|
|
8 |
|
9 |
from shiny import App, Inputs, Outputs, Session, reactive, render, req, ui
|
10 |
|
11 |
+
import os
|
12 |
+
os.environ["TRANSFORMERS_CACHE"] = Path(__file__).parent.resolve() / "cache"
|
13 |
+
|
14 |
from transformers import SamModel, SamConfig, SamProcessor
|
15 |
import torch
|
16 |
|
|
|
83 |
@render.image
|
84 |
def uploaded_image():
|
85 |
"""Displays the uploaded image"""
|
|
|
|
|
86 |
img_src = uploaded_image_path()
|
87 |
if img_src:
|
88 |
dir = Path(__file__).resolve().parent
|