Spaces:
Sleeping
Sleeping
uninstall old version gradio
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import os
|
|
2 |
import gradio as gr
|
3 |
print(f"Gradio version {gr.__version__}")
|
4 |
if gr.__version__ != '4.28.2':
|
|
|
5 |
os.system("pip install gradio==4.28.2")
|
6 |
print(f"Gradio version: {gr.__version__}")
|
7 |
|
@@ -10,9 +11,7 @@ import io
|
|
10 |
import torch
|
11 |
import json
|
12 |
import base64
|
13 |
-
import random
|
14 |
import numpy as np
|
15 |
-
import pandas as pd
|
16 |
from pathlib import Path
|
17 |
from PIL import Image
|
18 |
|
@@ -31,24 +30,8 @@ IMAGE2GT = json.load(open("data/jsons/image2gt.json", 'r'))
|
|
31 |
CUB_DESC_EMBEDS = torch.load('data/text_embeddings/cub_200_desc.pt').to(DEVICE)
|
32 |
CUB_IDX2NAME = json.load(open('data/jsons/cub_desc_idx2name.json', 'r'))
|
33 |
CUB_IDX2NAME = {int(k): v for k, v in CUB_IDX2NAME.items()}
|
34 |
-
|
35 |
-
|
36 |
-
# get the intersection of sachit and xclip (revised)
|
37 |
-
# INTERSECTION = []
|
38 |
-
# IMAGE_RES = 400 * 400 # minimum resolution
|
39 |
-
# TOTAL_SAMPLES = 20
|
40 |
-
# for file_name in XCLIP_RESULTS:
|
41 |
-
# image = Image.open(os.path.join(IMAGES_FOLDER, 'org', file_name)).convert('RGB')
|
42 |
-
# w, h = image.size
|
43 |
-
# if w * h < IMAGE_RES:
|
44 |
-
# continue
|
45 |
-
# else:
|
46 |
-
# INTERSECTION.append(file_name)
|
47 |
-
|
48 |
-
# IMAGE_FILE_LIST = random.sample(INTERSECTION, TOTAL_SAMPLES)
|
49 |
IMAGE_FILE_LIST = json.load(open("data/jsons/file_list.json", "r"))
|
50 |
-
# IMAGE_FILE_LIST = IMAGE_FILE_LIST[:19]
|
51 |
-
# IMAGE_FILE_LIST.append('Eastern_Bluebird.jpg')
|
52 |
IMAGE_GALLERY = [Image.open(os.path.join(IMAGES_FOLDER, 'org', file_name)).convert('RGB') for file_name in IMAGE_FILE_LIST]
|
53 |
|
54 |
ORG_PART_ORDER = ['back', 'beak', 'belly', 'breast', 'crown', 'forehead', 'eyes', 'legs', 'wings', 'nape', 'tail', 'throat']
|
|
|
2 |
import gradio as gr
|
3 |
print(f"Gradio version {gr.__version__}")
|
4 |
if gr.__version__ != '4.28.2':
|
5 |
+
os.system("pip uninstall gradio")
|
6 |
os.system("pip install gradio==4.28.2")
|
7 |
print(f"Gradio version: {gr.__version__}")
|
8 |
|
|
|
11 |
import torch
|
12 |
import json
|
13 |
import base64
|
|
|
14 |
import numpy as np
|
|
|
15 |
from pathlib import Path
|
16 |
from PIL import Image
|
17 |
|
|
|
30 |
CUB_DESC_EMBEDS = torch.load('data/text_embeddings/cub_200_desc.pt').to(DEVICE)
|
31 |
CUB_IDX2NAME = json.load(open('data/jsons/cub_desc_idx2name.json', 'r'))
|
32 |
CUB_IDX2NAME = {int(k): v for k, v in CUB_IDX2NAME.items()}
|
33 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
IMAGE_FILE_LIST = json.load(open("data/jsons/file_list.json", "r"))
|
|
|
|
|
35 |
IMAGE_GALLERY = [Image.open(os.path.join(IMAGES_FOLDER, 'org', file_name)).convert('RGB') for file_name in IMAGE_FILE_LIST]
|
36 |
|
37 |
ORG_PART_ORDER = ['back', 'beak', 'belly', 'breast', 'crown', 'forehead', 'eyes', 'legs', 'wings', 'nape', 'tail', 'throat']
|