tech5 commited on
Commit
8f5eb48
·
verified ·
1 Parent(s): 1d0cac3

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +36 -0
  2. bccd_yolov8.pt +3 -0
  3. requirements.txt +0 -0
app.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ # Create the app folder if it doesn't exist
4
+ os.makedirs('/content/BCCD-object/app', exist_ok=True)
5
+
6
+ # Define the Gradio app code
7
+ app_code = """
8
+ import gradio as gr
9
+ from ultralytics import YOLO
10
+ from PIL import Image
11
+
12
+ # Load the trained model
13
+ model = YOLO('/content/BCCD-object/model/bccd_yolov8.pt')
14
+
15
+ # Prediction function
16
+ def predict(image):
17
+ results = model(image)
18
+ annotated_image = results[0].plot() # Draw bounding boxes
19
+ return Image.fromarray(annotated_image)
20
+
21
+ # Gradio Interface
22
+ iface = gr.Interface(
23
+ fn=predict,
24
+ inputs=gr.Image(type="pil"),
25
+ outputs=gr.Image(type="pil"),
26
+ title="BCCD Object Detection",
27
+ description="Upload an image to detect RBC, WBC, and Platelets.",
28
+ )
29
+
30
+ # Launch the app
31
+ iface.launch(share=True)
32
+ """
33
+
34
+ # Save the code to app.py
35
+ with open('/content/BCCD-object/app/app.py', 'w') as f:
36
+ f.write(app_code)
bccd_yolov8.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fede7491faec35274bc71ef2540c828548a6dbbf4e4c04f7958db9da29b56eaa
3
+ size 6232035
requirements.txt ADDED
File without changes