kbressem nbroad HF staff commited on
Commit
b57b9f5
1 Parent(s): d768938

use proper pipeline example (#5)

Browse files

- use proper pipeline example (08232756a8a3f9f256f71705dab40e15c8ce88a3)


Co-authored-by: Nicholas Broad <nbroad@users.noreply.huggingface.co>

Files changed (1) hide show
  1. README.md +2 -2
README.md CHANGED
@@ -62,10 +62,10 @@ You can use the model for inference tasks like question-answering and medical di
62
 
63
  from transformers import pipeline
64
 
65
- qa_pipeline = pipeline("question-answering", model="medalpaca/medalpaca-7b", tokenizer="medalpaca/medalpaca-7b")
66
  question = "What are the symptoms of diabetes?"
67
  context = "Diabetes is a metabolic disease that causes high blood sugar. The symptoms include increased thirst, frequent urination, and unexplained weight loss."
68
- answer = qa_pipeline({"question": question, "context": context})
69
  print(answer)
70
  ```
71
 
 
62
 
63
  from transformers import pipeline
64
 
65
+ pl = pipeline("text-generation", model="medalpaca/medalpaca-7b", tokenizer="medalpaca/medalpaca-7b")
66
  question = "What are the symptoms of diabetes?"
67
  context = "Diabetes is a metabolic disease that causes high blood sugar. The symptoms include increased thirst, frequent urination, and unexplained weight loss."
68
+ answer = pl(f"Context: {context}\n\nQuestion: {question}\n\nAnswer: ")
69
  print(answer)
70
  ```
71