Spaces:
Build error
Build error
File size: 1,763 Bytes
ab40ac4 f318bfa 275b292 f318bfa 275b292 f318bfa ab40ac4 68efe72 ae36ee1 ab40ac4 275b292 f318bfa ab40ac4 86264b2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
from heinsight import HeinSight, HeinSightConfig
heinsight = HeinSight(vial_model_path="models/best_vessel.pt",
contents_model_path="models/best_content.pt",
config=HeinSightConfig())
import gradio as gr
description = """
[π HeinSight](https://gitlab.com/heingroup/heinsight4.0) detects vials and their contents in a single vessel image.
**Instructions:**
- Upload an image of a container (e.g., a HPLC vial or a reactor). Adjust the **Cap Size Ratio** slider if there is a lid on the vial.This ratio helps the detector estimate the relative size of the vial caps.
**Classifications:**
- **π« Empty**: No liquid; dry walls above expected fill line.
- **π§ Residue**: Visible solid deposit or stain above liquid level.
- **π₯ Homogeneous**: Clear liquid, optically uniform.
- **πͺ Heterogeneous**: Cloudy, turbid, or with phase separation.
- **π¦ Solid**: Dispersed solid in liquid or a separate solid phase visible.
"""
# Gradio UI
demo = gr.Interface(
fn=heinsight.image_demo,
inputs=[
gr.Image(type="pil", label="Single Vessel Image"),
gr.Slider(0.0, 1.0, step=0.01, value=0, label="Cap Size Ratio")
],
outputs=[
gr.Image(type="pil", label="Detected Image"),
gr.JSON(label="Detection Info") # or gr.Textbox() if you prefer plain text
],
title="HeinSight",
examples = [
["https://gitlab.com/heingroup/heinsight4.0/-/raw/main/examples/demo.png", 0.3],
],
description=description
)
if __name__ == "__main__":
demo.launch(mcp_server=True)
__mcp__ = {
"entry_point": heinsight.image_demo,
"inputs": ["image", "cap_ratio"],
"description": "HeinSight vial detector using image + cap ratio"
} |