datnguyentien204 commited on
Commit
253e609
1 Parent(s): 8c40f5c

Upload 8 files

Browse files
Files changed (8) hide show
  1. Dockerfile +30 -0
  2. helloworld.py +1 -0
  3. requirements.txt +3 -0
  4. su57.jpg +0 -0
  5. yolov10_predict.py +16 -0
  6. yolov10gradio.py +21 -0
  7. yolov10n.pt +3 -0
  8. yolov10streamlit.py +18 -0
Dockerfile ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10.13-slim
2
+
3
+ # DEMO
4
+ WORKDIR /app
5
+
6
+ COPY ./requirements.txt /app/requirements.txt
7
+ RUN apt-get update && apt-get install -y && rm -rf /var/lib/apt/lists/*
8
+ RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
9
+ RUN pip install -r requirements.txt
10
+
11
+ #USER
12
+ RUN useradd -m -u 1000 user
13
+ USER user
14
+ ENV HOME /home/user
15
+ ENV PATH $HOME/.local/bin:$PATH
16
+
17
+ WORKDIR $HOME
18
+ RUN mkdir app
19
+ WORKDIR $HOME/app
20
+ COPY . $HOME/app
21
+
22
+ EXPOSE 7860
23
+ CMD streamlit run yolov10streamlit.py \
24
+ --server.headless true \
25
+ --server.port 7860 \
26
+ --server.enableCORS false \
27
+ --server.enableXsrfProtection false \
28
+ --server.fileWatcherType none
29
+
30
+ #CMD python yolov10gradio.py
helloworld.py ADDED
@@ -0,0 +1 @@
 
 
1
+ print("Hello, World fro VAL-OD!")
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ streamlit
2
+ gradio
3
+ ultralytics
su57.jpg ADDED
yolov10_predict.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ultralytics import YOLO
2
+ import numpy as np
3
+ from PIL import Image
4
+ import matplotlib.pyplot as plt
5
+
6
+ model=YOLO('yolov10n.pt')
7
+
8
+ file="su57.jpg"
9
+ image=Image.open(file)
10
+
11
+ results=model.predict(source=np.array(image))
12
+ result_images=results[0].plot()
13
+
14
+ plt.imshow(result_images)
15
+ plt.axis('off')
16
+ plt.show()
yolov10gradio.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ultralytics import YOLO
2
+ import numpy as np
3
+ from PIL import Image
4
+ import matplotlib.pyplot as plt
5
+ import gradio as gr
6
+
7
+ model=YOLO('yolov10n.pt')
8
+ def predict_image(image):
9
+ np_image=np.array(image)
10
+ results=model.predict(source=np_image)
11
+ result_images=results[0].plot()
12
+ return result_images
13
+
14
+ iface=gr.Interface(
15
+ fn=predict_image,
16
+ inputs=gr.Image(type='pil', label="Chon mot tep anh? "),
17
+ outputs=gr.Image(type='pil', label="Anh dau ra"),
18
+ title="YOLOv10 Object Detection",
19
+ description="Chon mot tep anh de nhan dien doi tuong"
20
+ )
21
+ iface.launch()
yolov10n.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:11287ed0735678e7ba1ac2a9b3098c049155b3fde123992e724c1264bcc16b6f
3
+ size 5860383
yolov10streamlit.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ultralytics import YOLO
2
+ import numpy as np
3
+ from PIL import Image
4
+ import matplotlib.pyplot as plt
5
+ import streamlit as st
6
+
7
+ model=YOLO('yolov10n.pt')
8
+ st.title("YOLOv10 Object Detection")
9
+
10
+ uploaded_file=st.file_uploader("Chon mot tep anh? ", type=['jpg','jpeg','png'])
11
+ if uploaded_file is not None:
12
+ image = Image.open(uploaded_file)
13
+ st.image(image, caption="Anh dau vao", use_column_width=True)
14
+
15
+ if st.button("Predict"):
16
+ results=model.predict(source=np.array(image))
17
+ result_images = results[0].plot()
18
+ st.image(result_images, caption="Anh dau ra", use_column_width=True)