demo almost done
Browse files- BLIP/models/__pycache__/__init__.cpython-37.pyc +0 -0
- BLIP/models/__pycache__/blip.cpython-37.pyc +0 -0
- BLIP/models/__pycache__/med.cpython-37.pyc +0 -0
- BLIP/models/__pycache__/vit.cpython-37.pyc +0 -0
- BLIP/models/blip.py +4 -4
- app.py +2 -6
- flagged/log.csv +2 -0
- flagged/raw_image/tmpw95d_cla.jpg +0 -0
- requirements.py +1 -2
BLIP/models/__pycache__/__init__.cpython-37.pyc
ADDED
Binary file (170 Bytes). View file
|
|
BLIP/models/__pycache__/blip.cpython-37.pyc
ADDED
Binary file (7.18 kB). View file
|
|
BLIP/models/__pycache__/med.cpython-37.pyc
ADDED
Binary file (28.2 kB). View file
|
|
BLIP/models/__pycache__/vit.cpython-37.pyc
ADDED
Binary file (12.3 kB). View file
|
|
BLIP/models/blip.py
CHANGED
@@ -8,8 +8,8 @@
|
|
8 |
import warnings
|
9 |
warnings.filterwarnings("ignore")
|
10 |
|
11 |
-
from models.vit import VisionTransformer, interpolate_pos_embed
|
12 |
-
from models.med import BertConfig, BertModel, BertLMHeadModel
|
13 |
from transformers import BertTokenizer
|
14 |
|
15 |
import torch
|
@@ -22,7 +22,7 @@ from timm.models.hub import download_cached_file
|
|
22 |
|
23 |
class BLIP_Base(nn.Module):
|
24 |
def __init__(self,
|
25 |
-
med_config = 'configs/med_config.json',
|
26 |
image_size = 224,
|
27 |
vit = 'base',
|
28 |
vit_grad_ckpt = False,
|
@@ -77,7 +77,7 @@ class BLIP_Base(nn.Module):
|
|
77 |
|
78 |
class BLIP_Decoder(nn.Module):
|
79 |
def __init__(self,
|
80 |
-
med_config = 'configs/med_config.json',
|
81 |
image_size = 384,
|
82 |
vit = 'base',
|
83 |
vit_grad_ckpt = False,
|
|
|
8 |
import warnings
|
9 |
warnings.filterwarnings("ignore")
|
10 |
|
11 |
+
from BLIP.models.vit import VisionTransformer, interpolate_pos_embed
|
12 |
+
from BLIP.models.med import BertConfig, BertModel, BertLMHeadModel
|
13 |
from transformers import BertTokenizer
|
14 |
|
15 |
import torch
|
|
|
22 |
|
23 |
class BLIP_Base(nn.Module):
|
24 |
def __init__(self,
|
25 |
+
med_config = 'BLIP/configs/med_config.json',
|
26 |
image_size = 224,
|
27 |
vit = 'base',
|
28 |
vit_grad_ckpt = False,
|
|
|
77 |
|
78 |
class BLIP_Decoder(nn.Module):
|
79 |
def __init__(self,
|
80 |
+
med_config = 'BLIP/configs/med_config.json',
|
81 |
image_size = 384,
|
82 |
vit = 'base',
|
83 |
vit_grad_ckpt = False,
|
app.py
CHANGED
@@ -6,23 +6,19 @@
|
|
6 |
# iface = gr.Interface(fn=greet, inputs="image", outputs="text")
|
7 |
# iface.launch()
|
8 |
|
9 |
-
|
10 |
import sys
|
11 |
-
from IPython.display import display, HTML
|
12 |
from BLIP.models.blip import blip_decoder
|
13 |
-
from google_drive_downloader import GoogleDriveDownloader as gdd
|
14 |
from PIL import Image
|
15 |
import requests
|
16 |
import torch
|
17 |
from torchvision import transforms
|
18 |
from torchvision.transforms.functional import InterpolationMode
|
19 |
from urllib.parse import urlparse
|
20 |
-
from google_drive_downloader import GoogleDriveDownloader as gdd
|
21 |
-
|
22 |
|
23 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
24 |
|
25 |
-
|
26 |
transform = transforms.Compose([
|
27 |
transforms.Resize((image_size,image_size),interpolation=InterpolationMode.BICUBIC),
|
28 |
transforms.ToTensor(),
|
|
|
6 |
# iface = gr.Interface(fn=greet, inputs="image", outputs="text")
|
7 |
# iface.launch()
|
8 |
|
9 |
+
import gradio as gr
|
10 |
import sys
|
|
|
11 |
from BLIP.models.blip import blip_decoder
|
|
|
12 |
from PIL import Image
|
13 |
import requests
|
14 |
import torch
|
15 |
from torchvision import transforms
|
16 |
from torchvision.transforms.functional import InterpolationMode
|
17 |
from urllib.parse import urlparse
|
|
|
|
|
18 |
|
19 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
20 |
|
21 |
+
image_size = 384
|
22 |
transform = transforms.Compose([
|
23 |
transforms.Resize((image_size,image_size),interpolation=InterpolationMode.BICUBIC),
|
24 |
transforms.ToTensor(),
|
flagged/log.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
raw_image,Caption,flag,username,timestamp
|
2 |
+
/Users/snoamr/Documents/superCap/internet_page/demo/FuseCap/flagged/raw_image/tmpw95d_cla.jpg,a white dog celebrates its birthday with a colorful array of balloons and a cake on a white table the dog wears a pink hat and has an open mouth as it enjoys the festivities,,,2023-05-25 12:59:13.544370
|
flagged/raw_image/tmpw95d_cla.jpg
ADDED
requirements.py
CHANGED
@@ -3,5 +3,4 @@ transformers==4.15.0
|
|
3 |
fairscale==0.4.4
|
4 |
torch
|
5 |
torchvision
|
6 |
-
Pillow
|
7 |
-
google_drive_downloader
|
|
|
3 |
fairscale==0.4.4
|
4 |
torch
|
5 |
torchvision
|
6 |
+
Pillow
|
|