Update README.md
Browse files
README.md
CHANGED
@@ -49,10 +49,10 @@ model_pretrained.config.pad_token_id = tokenizer.eos_token_id
|
|
49 |
pipe = pipeline(task="text-generation", model=model_pretrained, tokenizer=tokenizer, max_length=100)
|
50 |
|
51 |
def build_prompt(question):
|
52 |
-
|
53 |
-
|
54 |
|
55 |
-
question = "
|
56 |
prompt = build_prompt(question)
|
57 |
|
58 |
# Generate text based on the prompt
|
@@ -66,6 +66,39 @@ print(generated_text)
|
|
66 |
|
67 |
|
68 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
## Training Data
|
71 |
- **Dataset Name:** AI Medical Chatbot
|
|
|
49 |
pipe = pipeline(task="text-generation", model=model_pretrained, tokenizer=tokenizer, max_length=100)
|
50 |
|
51 |
def build_prompt(question):
|
52 |
+
prompt=f"[INST]@Enlighten. {question} [/INST]"
|
53 |
+
return prompt
|
54 |
|
55 |
+
question = "What does abutment of the nerve root mean?"
|
56 |
prompt = build_prompt(question)
|
57 |
|
58 |
# Generate text based on the prompt
|
|
|
66 |
|
67 |
|
68 |
```
|
69 |
+
you will get somethinng like
|
70 |
+
```
|
71 |
+
Please help. For more information consult an internal medicine physician online ➜ http://iclinic.com/e/gastroenterologist-online-consultation.php.
|
72 |
+
```
|
73 |
+
|
74 |
+
|
75 |
+
|
76 |
+
also you can
|
77 |
+
|
78 |
+
```python
|
79 |
+
def ask(question):
|
80 |
+
promptEnding = "[/INST]"
|
81 |
+
# Guide for answering questions
|
82 |
+
testGuide = 'Answer the following question, at the end of your response say thank you for your query.\n'
|
83 |
+
# Build the question prompt
|
84 |
+
question = testGuide + question + "\n"
|
85 |
+
print(question)
|
86 |
+
# Build the prompt
|
87 |
+
prompt = build_prompt(question)
|
88 |
+
# Generate answer
|
89 |
+
result = pipe(prompt)
|
90 |
+
llmAnswer = result[0]['generated_text']
|
91 |
+
# Remove the prompt from the generated answer
|
92 |
+
index = llmAnswer.find(promptEnding)
|
93 |
+
llmAnswer = llmAnswer[len(promptEnding) + index:]
|
94 |
+
print("LLM Answer:")
|
95 |
+
print(llmAnswer)
|
96 |
+
|
97 |
+
question = "For how long should I take Kalachikai powder to overcome PCOD problem?"
|
98 |
+
ask(question)
|
99 |
+
```
|
100 |
+
|
101 |
+
|
102 |
|
103 |
## Training Data
|
104 |
- **Dataset Name:** AI Medical Chatbot
|