Spaces:
Runtime error
Runtime error
Update sample.py
Browse files
sample.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from PIL import Image
|
| 3 |
import torch
|
|
|
|
| 4 |
from torchvision import transforms
|
| 5 |
from ultralytics import YOLO
|
| 6 |
|
|
@@ -50,7 +51,7 @@ def main():
|
|
| 50 |
st.image(image, caption='Original Image', use_column_width=True)
|
| 51 |
|
| 52 |
output = model.predict(image)
|
| 53 |
-
output_image = Image.fromarray(output)
|
| 54 |
st.image(output_image, caption='Processed Image', use_column_width=True)
|
| 55 |
|
| 56 |
if __name__ == '__main__':
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from PIL import Image
|
| 3 |
import torch
|
| 4 |
+
import numpy as np
|
| 5 |
from torchvision import transforms
|
| 6 |
from ultralytics import YOLO
|
| 7 |
|
|
|
|
| 51 |
st.image(image, caption='Original Image', use_column_width=True)
|
| 52 |
|
| 53 |
output = model.predict(image)
|
| 54 |
+
output_image = Image.fromarray(np.array(output))
|
| 55 |
st.image(output_image, caption='Processed Image', use_column_width=True)
|
| 56 |
|
| 57 |
if __name__ == '__main__':
|