Spaces:
Running
Running
Samuel Stevens
commited on
Commit
•
293f004
1
Parent(s):
6e5adf0
fix image height
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import collections
|
|
2 |
import heapq
|
3 |
import json
|
4 |
import os
|
|
|
5 |
|
6 |
import gradio as gr
|
7 |
import numpy as np
|
@@ -12,6 +13,10 @@ from torchvision import transforms
|
|
12 |
|
13 |
from templates import openai_imagenet_template
|
14 |
|
|
|
|
|
|
|
|
|
15 |
hf_token = os.getenv("HF_TOKEN")
|
16 |
|
17 |
model_str = "hf-hub:imageomics/bioclip"
|
@@ -146,13 +151,13 @@ def change_output(choice):
|
|
146 |
|
147 |
|
148 |
if __name__ == "__main__":
|
149 |
-
|
150 |
model = create_model(model_str, output_dict=True, require_pretrained=True)
|
151 |
model = model.to(device)
|
152 |
-
|
153 |
|
154 |
model = torch.compile(model)
|
155 |
-
|
156 |
|
157 |
tokenizer = get_tokenizer(tokenizer_str)
|
158 |
|
@@ -167,7 +172,7 @@ if __name__ == "__main__":
|
|
167 |
status_msg = f"{done}/{total} ({done / total * 100:.1f}%) indexed"
|
168 |
|
169 |
with gr.Blocks() as app:
|
170 |
-
img_input = gr.Image(
|
171 |
|
172 |
with gr.Tab("Open-Ended"):
|
173 |
with gr.Row():
|
|
|
2 |
import heapq
|
3 |
import json
|
4 |
import os
|
5 |
+
import logging
|
6 |
|
7 |
import gradio as gr
|
8 |
import numpy as np
|
|
|
13 |
|
14 |
from templates import openai_imagenet_template
|
15 |
|
16 |
+
log_format = "[%(asctime)s] [%(levelname)s] [%(name)s] %(message)s"
|
17 |
+
logging.basicConfig(level=logging.INFO, format=log_format)
|
18 |
+
logger = logging.getLogger()
|
19 |
+
|
20 |
hf_token = os.getenv("HF_TOKEN")
|
21 |
|
22 |
model_str = "hf-hub:imageomics/bioclip"
|
|
|
151 |
|
152 |
|
153 |
if __name__ == "__main__":
|
154 |
+
logger.info("Starting.")
|
155 |
model = create_model(model_str, output_dict=True, require_pretrained=True)
|
156 |
model = model.to(device)
|
157 |
+
logger.info("Created model.")
|
158 |
|
159 |
model = torch.compile(model)
|
160 |
+
logger.info("Compiled model.")
|
161 |
|
162 |
tokenizer = get_tokenizer(tokenizer_str)
|
163 |
|
|
|
172 |
status_msg = f"{done}/{total} ({done / total * 100:.1f}%) indexed"
|
173 |
|
174 |
with gr.Blocks() as app:
|
175 |
+
img_input = gr.Image()
|
176 |
|
177 |
with gr.Tab("Open-Ended"):
|
178 |
with gr.Row():
|