AItrika
1.0.0

增强您在医学研究方面的知识。
Aitrika(以前是Pubgpt )是一种工具,可以以一种简单的方式提取大量相关信息:
等等!
您可以通过运行:
streamlit run app.py
或者,您可以通过运行:
python main.py
要安装所有内容,您需要uv 。
首先,使用命令安装uv :
python main.py
之后,使用命令创建虚拟环境:
uv venv venv_name
激活虚拟env:
source venv_name/bin/activate
并安装依赖项:
uv pip install -r requirements.in
为了设置API键,请将您的密钥插入env.example文件并将其重命名为.env 。
您可以通过通过PubMed ID来轻松获取论文的信息:
from aitrika . engine . aitrika import OnlineAItrika
aitrika_engine = OnlineAItrika ( pubmed_id = pubmed_id )
title = aitrika_engine . get_title ()
print ( title )或者您可以解析本地PDF:
from aitrika . engine . aitrika import LocalAItrika
aitrika_engine = LocalAItrika ( pdf_path = pdf_path )
title = aitrika_engine . get_title ()
print ( title ) Breast cancer genes: beyond BRCA1 and BRCA2.
您可以获得其他信息,例如基因和疾病之间的关联:
associations = aitrika_engine . get_associations () [
{
"gene": "BRIP1",
"disease": "Breast Neoplasms"
},
{
"gene": "PTEN",
"disease": "Breast Neoplasms"
},
{
"gene": "CHEK2",
"disease": "Breast Neoplasms"
},
]
...
或者,您可以获得一个不错的格式数据框架:
associations = aitrika_engine . associations ( dataframe = True ) gene disease
0 BRIP1 Breast Neoplasms
1 PTEN Breast Neoplasms
2 CHEK2 Breast Neoplasms
...
借助抹布的力量,您可以查询文档:
## Prepare the documents
documents = generate_documents ( content = abstract )
## Set the LLM
llm = GroqLLM ( documents = documents , api_key = os . getenv ( "GROQ_API_KEY" ))
## Query your document
query = "Is BRCA1 associated with breast cancer?"
print ( llm . query ( query = query )) The provided text suggests that BRCA1 is associated with breast cancer, as it is listed among the high-penetrance genes identified in family linkage studies as responsible for inherited syndromes of breast cancer.
或者您可以提取其他信息:
results = engine . extract_results ( llm = llm )
print ( results ) ** RESULTS **
- High-penetrance genes - BRCA1, BRCA2, PTEN, TP53 - responsible for inherited syndromes
- Moderate-penetrance genes - CHEK2, ATM, BRIP1, PALB2, RAD51C - associated with moderate BC risk
- Low-penetrance alleles - common alleles - associated with slightly increased or decreased risk of BC
- Current clinical practice - high-penetrance genes - widely used
- Future prospect - all familial breast cancer genes - to be included in genetic test
- Research need - clinical management - of moderate and low-risk variants
要运行Aitrika API,请按照以下步骤:
确保您已经设置了环境,并如安装部分所述安装了所有依赖关系。
使用以下命令运行API服务器:
python api.pyAPI将开始在http://0.0.0.0:8000上运行。您现在可以向各种端点提出请求:
您可以使用Curl,Postman或任何HTTP客户端等工具与API进行交互。例如:
curl -X POST " http://localhost:8000/abstract " -H " Content-Type: application/json " -d ' {"pubmed_id": 12345678} ' API文档将自动生成并保存到docs/api-reference/openapi.json 。您可以将此文件与Swagger UI之类的工具一起使用,以获得更具交互性的API探索体验。
如果您觉得这个项目有用,请考虑支持它:
如果您在商业或商业环境中使用此项目,请与我联系。
我可以咨询,定制开发或商业许可。
您的支持有助于使该项目保持活跃并不断改进。谢谢你!
Aitrika已获得Apache 2.0许可证的许可。有关更多详细信息,请参见许可证文件。