Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files
Makefile
CHANGED
@@ -4,4 +4,7 @@ build:
|
|
4 |
docker build -t $(APP) .
|
5 |
|
6 |
run:
|
7 |
-
docker run -it --rm --gpus all -p 7860:7860 $(APP)
|
|
|
|
|
|
|
|
4 |
docker build -t $(APP) .
|
5 |
|
6 |
run:
|
7 |
+
docker run -it --rm --gpus all -p 7860:7860 $(APP)
|
8 |
+
|
9 |
+
run-local:
|
10 |
+
python3 app.py
|
app.py
CHANGED
@@ -21,8 +21,8 @@ from functools import partial
|
|
21 |
app = FastAPI()
|
22 |
|
23 |
# Load the model
|
24 |
-
model: YOLO = YOLO('model/autodistill_best.pt') # Path to trained model
|
25 |
-
seg_model: YOLO = YOLO('model/autodistill_best_seg.pt') # Path to trained model
|
26 |
|
27 |
# Directories
|
28 |
image_dir = './pdf_images/'
|
@@ -43,9 +43,9 @@ HTML = """
|
|
43 |
|
44 |
# sam = SAM()
|
45 |
|
46 |
-
@app.get("/")
|
47 |
-
def read_main():
|
48 |
-
|
49 |
|
50 |
|
51 |
# @app.get("/foo")
|
@@ -53,14 +53,15 @@ def read_main():
|
|
53 |
# return RedirectResponse("/gradio")
|
54 |
|
55 |
|
56 |
-
def detect_solar_panel(image) -> Results:
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
|
61 |
|
62 |
def segment_solar_panel(image) -> Results:
|
63 |
# Perform inference
|
|
|
64 |
results: Results = seg_model.predict(image, imgsz=(841, 595), retina_masks=True)
|
65 |
return results
|
66 |
|
@@ -236,7 +237,7 @@ def extract_image(uploadFile: UploadFile) -> FileResponse:
|
|
236 |
jpeg_image.save(filename)
|
237 |
return FileResponse(filename)
|
238 |
|
239 |
-
app = gr.mount_gradio_app(app, demo, path="/
|
240 |
|
241 |
if __name__ == "__main__":
|
242 |
# app = gr.mount_gradio_app(app, demo, path="/gradio")
|
|
|
21 |
app = FastAPI()
|
22 |
|
23 |
# Load the model
|
24 |
+
# model: YOLO = YOLO('model/autodistill_best.pt') # Path to trained model
|
25 |
+
# seg_model: YOLO = YOLO('model/autodistill_best_seg.pt') # Path to trained model
|
26 |
|
27 |
# Directories
|
28 |
image_dir = './pdf_images/'
|
|
|
43 |
|
44 |
# sam = SAM()
|
45 |
|
46 |
+
# @app.get("/")
|
47 |
+
# def read_main():
|
48 |
+
# return HTMLResponse(HTML)
|
49 |
|
50 |
|
51 |
# @app.get("/foo")
|
|
|
53 |
# return RedirectResponse("/gradio")
|
54 |
|
55 |
|
56 |
+
# def detect_solar_panel(image) -> Results:
|
57 |
+
# # Perform inference
|
58 |
+
# results: Results = model(image)
|
59 |
+
# return results
|
60 |
|
61 |
|
62 |
def segment_solar_panel(image) -> Results:
|
63 |
# Perform inference
|
64 |
+
seg_model: YOLO = YOLO('model/autodistill_best_seg.pt')
|
65 |
results: Results = seg_model.predict(image, imgsz=(841, 595), retina_masks=True)
|
66 |
return results
|
67 |
|
|
|
237 |
jpeg_image.save(filename)
|
238 |
return FileResponse(filename)
|
239 |
|
240 |
+
app = gr.mount_gradio_app(app, demo, path="/")
|
241 |
|
242 |
if __name__ == "__main__":
|
243 |
# app = gr.mount_gradio_app(app, demo, path="/gradio")
|