Spaces:
Sleeping
Sleeping
Samanta Das
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
from PIL import Image, ImageDraw
|
3 |
-
import sys
|
4 |
import os
|
5 |
import time
|
6 |
import threading
|
@@ -15,13 +14,13 @@ from llama import generate_response_based_on_yolo
|
|
15 |
|
16 |
# Define model path and output folder relative to the app's directory
|
17 |
MODEL_PATH = 'yolov8n_custom.pkl' # Update this to the relative path of your model on Hugging Face Spaces
|
18 |
-
OUTPUT_FOLDER = '
|
19 |
|
20 |
# Ensure the output folder exists
|
21 |
os.makedirs(OUTPUT_FOLDER, exist_ok=True)
|
22 |
|
23 |
# Initialize the fracture detector
|
24 |
-
detector = FractureDetector(MODEL_PATH
|
25 |
|
26 |
def delete_file_after_delay(file_path, delay):
|
27 |
"""Delete the specified file after a given delay."""
|
|
|
1 |
import gradio as gr
|
2 |
from PIL import Image, ImageDraw
|
|
|
3 |
import os
|
4 |
import time
|
5 |
import threading
|
|
|
14 |
|
15 |
# Define model path and output folder relative to the app's directory
|
16 |
MODEL_PATH = 'yolov8n_custom.pkl' # Update this to the relative path of your model on Hugging Face Spaces
|
17 |
+
OUTPUT_FOLDER = './output_images' # Use a relative path to avoid permission issues
|
18 |
|
19 |
# Ensure the output folder exists
|
20 |
os.makedirs(OUTPUT_FOLDER, exist_ok=True)
|
21 |
|
22 |
# Initialize the fracture detector
|
23 |
+
detector = FractureDetector(MODEL_PATH)
|
24 |
|
25 |
def delete_file_after_delay(file_path, delay):
|
26 |
"""Delete the specified file after a given delay."""
|