Spaces:
Sleeping
Sleeping
Commit ·
6e0faa9
1
Parent(s): a06ac21
update
Browse files
.gitignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__pycache__/*
|
| 2 |
+
|
README.md
CHANGED
|
@@ -12,6 +12,10 @@ pinned: false
|
|
| 12 |
# Medical Knowledge Graph Construction (medKGC)
|
| 13 |
|
| 14 |
## Overview
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
medKGC is a medical text knowledge graph construction and review system. It supports entity recognition, relation extraction, and visualization of medical reports, providing a convenient review interface.
|
| 16 |
|
| 17 |
## Deployment
|
|
@@ -33,6 +37,9 @@ pip install -r requirements.txt
|
|
| 33 |
streamlit run app.py
|
| 34 |
```
|
| 35 |
|
|
|
|
|
|
|
|
|
|
| 36 |
## Core Features
|
| 37 |
|
| 38 |
### 1. Data Processing
|
|
@@ -102,7 +109,7 @@ def find_relations_with_entities(entities, entities_data):
|
|
| 102 |
## TODO
|
| 103 |
1. [ ] Add data export functionality
|
| 104 |
2. [ ] Named Entity Recognition
|
| 105 |
-
1. [ ] 增加输入框
|
| 106 |
2. [ ] 调用llms
|
| 107 |
3. [ ] Relation Extraction
|
| 108 |
1. [ ] Add relation editing functionality
|
|
|
|
| 12 |
# Medical Knowledge Graph Construction (medKGC)
|
| 13 |
|
| 14 |
## Overview
|
| 15 |
+
A automated annotion tool using LLMs to help medical annotators annotate the input radiology reports.
|
| 16 |
+
|
| 17 |
+
这个工具涉及了Named Entity Recognition,relation extraction, named entity normalization,最终结果会以知识图谱的形式输出。
|
| 18 |
+
|
| 19 |
medKGC is a medical text knowledge graph construction and review system. It supports entity recognition, relation extraction, and visualization of medical reports, providing a convenient review interface.
|
| 20 |
|
| 21 |
## Deployment
|
|
|
|
| 37 |
streamlit run app.py
|
| 38 |
```
|
| 39 |
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
|
| 43 |
## Core Features
|
| 44 |
|
| 45 |
### 1. Data Processing
|
|
|
|
| 109 |
## TODO
|
| 110 |
1. [ ] Add data export functionality
|
| 111 |
2. [ ] Named Entity Recognition
|
| 112 |
+
1. [ ] 增加输入框
|
| 113 |
2. [ ] 调用llms
|
| 114 |
3. [ ] Relation Extraction
|
| 115 |
1. [ ] Add relation editing functionality
|
app_ui.py
CHANGED
|
@@ -7,10 +7,10 @@ from app_logic import *
|
|
| 7 |
def display_entity_selections(selections):
|
| 8 |
"""Display entity selections in a grid layout"""
|
| 9 |
st.subheader("Selected Entities:")
|
| 10 |
-
|
| 11 |
# 使用columns来水平排列按钮
|
| 12 |
cols = st.columns(4) # 每行4个按钮
|
| 13 |
-
|
| 14 |
for i, entity in enumerate(selections):
|
| 15 |
col_idx = i % 4
|
| 16 |
with cols[col_idx]:
|
|
@@ -144,23 +144,23 @@ def handle_review_submission(selected_report, selections, entities_data):
|
|
| 144 |
|
| 145 |
def setup_input_selection():
|
| 146 |
"""设置输入方式选择"""
|
| 147 |
-
st.subheader("
|
| 148 |
input_method = st.radio(
|
| 149 |
-
"
|
| 150 |
-
["
|
| 151 |
key="input_method"
|
| 152 |
)
|
| 153 |
-
|
| 154 |
-
if input_method == "
|
| 155 |
user_text = st.text_area(
|
| 156 |
-
"
|
| 157 |
height=200,
|
| 158 |
-
placeholder="
|
| 159 |
key="user_input_text"
|
| 160 |
)
|
| 161 |
-
if st.button("
|
| 162 |
return {"type": "user_input", "text": user_text}
|
| 163 |
else:
|
| 164 |
return {"type": "dataset"}
|
| 165 |
-
|
| 166 |
return None
|
|
|
|
| 7 |
def display_entity_selections(selections):
|
| 8 |
"""Display entity selections in a grid layout"""
|
| 9 |
st.subheader("Selected Entities:")
|
| 10 |
+
|
| 11 |
# 使用columns来水平排列按钮
|
| 12 |
cols = st.columns(4) # 每行4个按钮
|
| 13 |
+
|
| 14 |
for i, entity in enumerate(selections):
|
| 15 |
col_idx = i % 4
|
| 16 |
with cols[col_idx]:
|
|
|
|
| 144 |
|
| 145 |
def setup_input_selection():
|
| 146 |
"""设置输入方式选择"""
|
| 147 |
+
st.subheader("Select Input Method")
|
| 148 |
input_method = st.radio(
|
| 149 |
+
"Select Input Method",
|
| 150 |
+
["Select from Dataset", "Manual Text Input"],
|
| 151 |
key="input_method"
|
| 152 |
)
|
| 153 |
+
|
| 154 |
+
if input_method == "Manual Text Input":
|
| 155 |
user_text = st.text_area(
|
| 156 |
+
"Please Input Radiology Report Text",
|
| 157 |
height=200,
|
| 158 |
+
placeholder="Enter report text here...",
|
| 159 |
key="user_input_text"
|
| 160 |
)
|
| 161 |
+
if st.button("Analyze Text"):
|
| 162 |
return {"type": "user_input", "text": user_text}
|
| 163 |
else:
|
| 164 |
return {"type": "dataset"}
|
| 165 |
+
|
| 166 |
return None
|
start.sh
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#! /usr/bin/env bash
|
| 2 |
+
# Source conda to enable 'conda activate'
|
| 3 |
+
source "$(conda info --base)/etc/profile.d/conda.sh"
|
| 4 |
+
conda activate medkgc
|
| 5 |
+
# Install dependencies
|
| 6 |
+
pip install -r requirements.txt
|
| 7 |
+
# Start the Streamlit app
|
| 8 |
+
streamlit run app.py
|