Spaces:
Runtime error
Runtime error
fix load image
Browse files
app.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import torch
|
| 3 |
-
import cv2
|
| 4 |
import numpy as np
|
| 5 |
from PIL import Image
|
| 6 |
from transformers import pipeline, OwlViTProcessor, OwlViTForObjectDetection
|
|
@@ -42,10 +41,9 @@ if uploaded_image_zero_file is not None:
|
|
| 42 |
with NamedTemporaryFile() as temp:
|
| 43 |
temp.write(uploaded_image_zero_file.getvalue())
|
| 44 |
temp.seek(0)
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
st.image(
|
| 48 |
-
image = Image.open(temp.name)
|
| 49 |
inputs = processor(text=texts, images=image, return_tensors="pt")
|
| 50 |
outputs = model(**inputs)
|
| 51 |
target_sizes = torch.Tensor([image.size[::-1]])
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import torch
|
|
|
|
| 3 |
import numpy as np
|
| 4 |
from PIL import Image
|
| 5 |
from transformers import pipeline, OwlViTProcessor, OwlViTForObjectDetection
|
|
|
|
| 41 |
with NamedTemporaryFile() as temp:
|
| 42 |
temp.write(uploaded_image_zero_file.getvalue())
|
| 43 |
temp.seek(0)
|
| 44 |
+
image = Image.open(uploaded_image_zero_file)
|
| 45 |
+
outputImage = np.array(image)
|
| 46 |
+
st.image(outputImage)
|
|
|
|
| 47 |
inputs = processor(text=texts, images=image, return_tensors="pt")
|
| 48 |
outputs = model(**inputs)
|
| 49 |
target_sizes = torch.Tensor([image.size[::-1]])
|