Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ import cv2
|
|
| 5 |
import gradio as gr
|
| 6 |
from fastapi import FastAPI
|
| 7 |
from fastapi.responses import HTMLResponse
|
| 8 |
-
from fastrtc import Stream,
|
| 9 |
from gradio.utils import get_space
|
| 10 |
from huggingface_hub import hf_hub_download
|
| 11 |
from pydantic import BaseModel, Field
|
|
@@ -26,16 +26,10 @@ model = YOLOv10(model_file)
|
|
| 26 |
|
| 27 |
|
| 28 |
def detection(image, conf_threshold=0.3):
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
return cv2.resize(new_image, (500, 500))
|
| 34 |
-
except Exception as e:
|
| 35 |
-
import traceback
|
| 36 |
-
|
| 37 |
-
traceback.print_exc()
|
| 38 |
-
raise WebRTCError(str(e))
|
| 39 |
|
| 40 |
|
| 41 |
stream = Stream(
|
|
|
|
| 5 |
import gradio as gr
|
| 6 |
from fastapi import FastAPI
|
| 7 |
from fastapi.responses import HTMLResponse
|
| 8 |
+
from fastrtc import Stream, get_twilio_turn_credentials
|
| 9 |
from gradio.utils import get_space
|
| 10 |
from huggingface_hub import hf_hub_download
|
| 11 |
from pydantic import BaseModel, Field
|
|
|
|
| 26 |
|
| 27 |
|
| 28 |
def detection(image, conf_threshold=0.3):
|
| 29 |
+
image = cv2.resize(image, (model.input_width, model.input_height))
|
| 30 |
+
print("conf_threshold", conf_threshold)
|
| 31 |
+
new_image = model.detect_objects(image, conf_threshold)
|
| 32 |
+
return cv2.resize(new_image, (500, 500))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
|
| 35 |
stream = Stream(
|