heigon77 commited on
Commit
9141f04
·
1 Parent(s): 1f2802f

Adding root

Browse files
Files changed (1) hide show
  1. main.py +30 -2
main.py CHANGED
@@ -205,7 +205,7 @@ def health():
205
  "status": "ok",
206
  "yolo_classes": len(yolo_model.names),
207
  "style_classes": len(STYLES),
208
- "llm": "phi3_mini_4k_q4.gguf"
209
  }
210
 
211
  @app.post("/detect")
@@ -246,4 +246,32 @@ async def detect(file: UploadFile = File(...)):
246
  "annotated_image": encode_image(results.plot()),
247
  "image_width": int(img_np.shape[1]),
248
  "image_height": int(img_np.shape[0]),
249
- })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  "status": "ok",
206
  "yolo_classes": len(yolo_model.names),
207
  "style_classes": len(STYLES),
208
+ "llm": "qwen2.5-1.5b-instruct-fp16.gguf"
209
  }
210
 
211
  @app.post("/detect")
 
246
  "annotated_image": encode_image(results.plot()),
247
  "image_width": int(img_np.shape[1]),
248
  "image_height": int(img_np.shape[0]),
249
+ })
250
+
251
+ @app.get("/")
252
+ def root():
253
+ return {
254
+ "status": "ok",
255
+ "description": "Art analysis API: detects objects, classifies artistic style and generates a Shakespearean sonnet from paintings.",
256
+ "models": {
257
+ "object_detection": {
258
+ "file": "yolo_deart.onnx",
259
+ "description": "Custom YOLOv8 fine-tuned for art object detection"
260
+ },
261
+ "style_classification": {
262
+ "file": "style_classifier.onnx",
263
+ "classes": len(STYLES),
264
+ "description": f"ONNX classifier for {len(STYLES)} artistic styles (Baroque, Impressionism, Cubism…)"
265
+ },
266
+ "poem_generation": {
267
+ "model": "Qwen2.5-1.5B-Instruct (FP16 GGUF)",
268
+ "backend": "llama-cpp",
269
+ "description": "Generates a Shakespearean sonnet based on detected objects and art style"
270
+ }
271
+ },
272
+ "endpoints": {
273
+ "GET /": "This overview",
274
+ "GET /health": "Runtime status and loaded model info",
275
+ "POST /detect": "Upload a painting image → returns detections, style, poem and annotated image"
276
+ }
277
+ }