From a121b88c87b7b712552287a6252b2103a60ff90b Mon Sep 17 00:00:00 2001 From: Monk Date: Sat, 22 Jul 2023 09:52:39 +0530 Subject: [PATCH] Update medical_ner.py --- examples/medical_ner.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/examples/medical_ner.py b/examples/medical_ner.py index aea130e..b1ba13c 100644 --- a/examples/medical_ner.py +++ b/examples/medical_ner.py @@ -1,18 +1,15 @@ -from promptify import OpenAI -from promptify import Prompter +from promptify import Prompter,OpenAI, Pipeline -sentence = """The patient is a 93-year-old female with a medical +sentence = "The patient is a 93-year-old female with a medical history of chronic right hip pain, osteoporosis, hypertension, depression, and chronic atrial fibrillation admitted for evaluation and management of severe nausea and vomiting and urinary tract - infection""" + infection" +model = OpenAI(api_key) # or `HubModel()` for Huggingface-based inference or 'Azure' etc +prompter = Prompter('ner.jinja') # select a template or provide custom template +pipe = Pipeline(prompter , model) -model = OpenAI(api_key="") - -prompter = Prompter(model=model, template="ner.jinja") - -output = prompter.fit(text_input=sentence, domain="medical", labels=None) - +output = pipe.fit(text_input=sentence, domain="medical", labels=None) print(output)