bryanmildort commited on
Commit
8441878
·
1 Parent(s): 9b14a58

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -14,10 +14,12 @@ st.markdown("<h6 style='text-align: center; color: #489DDB;'>by Bryan Mildort</h
14
 
15
  from transformers import AutoTokenizer, AutoModelForCausalLM
16
  import torch
 
 
 
17
  tokenizer = AutoTokenizer.from_pretrained("bryanmildort/gpt-clinical-notes-summarizer")
18
- model = AutoModelForCausalLM.from_pretrained(
19
- "bryanmildort/gpt-clinical-notes-summarizer", torch_dtype=torch.float16, low_cpu_mem_usage=True,
20
- )
21
 
22
  prompt = """Edie Whelan is a 26 yo female who is here for follow-up following an ED visit for palpitations 2 weeks ago. She had a normal workup in the ED consisting of CBC, metabolic panel, cardiac enzymes and and ECG. She states that she has a 5 yr hx of palpitations with SOB, throat tightening, nause and clamminess. these have been increasing in frequency in the past few weeks to 1-2x a day until 2 weeks ago when she had associated numbness in her fingers. She states that there are no precipitating events and these stop on their own. She endorses recent life stressors having bought a condo 3 months ago and lost her job 2 months ago. She denies fevers, chills, changes in skin/hair/nails or chest pain/tightness. She denies vision or hearing changes.
23
  PMH: none, Meds: none, Allergies: none, Surgeries: None, Family hx: none
 
14
 
15
  from transformers import AutoTokenizer, AutoModelForCausalLM
16
  import torch
17
+ device = "cuda:0" if torch.cuda.is_available() else "cpu"
18
+ device_str = f"""Device being used: {device}"""
19
+ st.write(device_str)
20
  tokenizer = AutoTokenizer.from_pretrained("bryanmildort/gpt-clinical-notes-summarizer")
21
+ model = AutoModelForCausalLM.from_pretrained("bryanmildort/gpt-clinical-notes-summarizer")
22
+ model = model.to(device)
 
23
 
24
  prompt = """Edie Whelan is a 26 yo female who is here for follow-up following an ED visit for palpitations 2 weeks ago. She had a normal workup in the ED consisting of CBC, metabolic panel, cardiac enzymes and and ECG. She states that she has a 5 yr hx of palpitations with SOB, throat tightening, nause and clamminess. these have been increasing in frequency in the past few weeks to 1-2x a day until 2 weeks ago when she had associated numbness in her fingers. She states that there are no precipitating events and these stop on their own. She endorses recent life stressors having bought a condo 3 months ago and lost her job 2 months ago. She denies fevers, chills, changes in skin/hair/nails or chest pain/tightness. She denies vision or hearing changes.
25
  PMH: none, Meds: none, Allergies: none, Surgeries: None, Family hx: none