Spaces:
Build error
Build error
Upload folder using huggingface_hub
Browse files- app.py +5 -3
- requirements.txt +1 -1
app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import numpy as np
|
2 |
import random
|
3 |
from PIL import Image
|
@@ -9,8 +11,8 @@ import torch
|
|
9 |
import torchvision.transforms as transforms
|
10 |
from PIL import Image
|
11 |
|
12 |
-
|
13 |
-
model = tag2text(pretrained='tag2text.pth', image_size=384, vit='swin_b')
|
14 |
model.threshold = 0.68
|
15 |
model.eval()
|
16 |
|
@@ -43,7 +45,7 @@ gr.Interface(
|
|
43 |
inputs=inputs,
|
44 |
outputs=outputs,
|
45 |
title="Tags and Captioning using Tag2Text",
|
46 |
-
description="Upload an image and see the
|
47 |
live=True,
|
48 |
|
49 |
).launch(share=True, enable_queue=True, debug=True)
|
|
|
1 |
+
from IPython.display import clear_output, Image
|
2 |
+
import argparse
|
3 |
import numpy as np
|
4 |
import random
|
5 |
from PIL import Image
|
|
|
11 |
import torchvision.transforms as transforms
|
12 |
from PIL import Image
|
13 |
|
14 |
+
evice = torch.device('cpu')
|
15 |
+
model = tag2text(pretrained='/content/recognize-anything/tag2text.pth', image_size=384, vit='swin_b')
|
16 |
model.threshold = 0.68
|
17 |
model.eval()
|
18 |
|
|
|
45 |
inputs=inputs,
|
46 |
outputs=outputs,
|
47 |
title="Tags and Captioning using Tag2Text",
|
48 |
+
description="Upload an image and see the results in text boxes.",
|
49 |
live=True,
|
50 |
|
51 |
).launch(share=True, enable_queue=True, debug=True)
|
requirements.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
timm==0.4.12
|
2 |
-
transformers
|
3 |
fairscale==0.4.4
|
4 |
pycocoevalcap
|
5 |
torch
|
|
|
1 |
timm==0.4.12
|
2 |
+
transformers==4.15.0
|
3 |
fairscale==0.4.4
|
4 |
pycocoevalcap
|
5 |
torch
|