extoncs commited on
Commit
c6f339f
·
verified ·
1 Parent(s): acd270a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -11,7 +11,8 @@ st.title("🩺 ChatDoctor - Medical Assistant")
11
  # Load model and tokenizer
12
  @st.cache_resource
13
  def load_model():
14
- model = AutoModelForCausalLM.from_pretrained("abhiyanta/chatDoctor", use_cache=True).to("cpu")
 
15
  tokenizer = AutoTokenizer.from_pretrained("abhiyanta/chatDoctor")
16
  return model, tokenizer
17
 
@@ -33,7 +34,7 @@ if st.button("Ask ChatDoctor"):
33
  ""
34
  )
35
 
36
- # Tokenize and move to CPU
37
  inputs = tokenizer([formatted_prompt], return_tensors="pt").to("cpu")
38
 
39
  # Stream the generated output
@@ -48,4 +49,4 @@ if st.button("Ask ChatDoctor"):
48
 
49
  # Footer
50
  st.markdown("---")
51
- st.caption("Powered by Hugging Face 🤗 and bitsandbytes ⚡")
 
11
  # Load model and tokenizer
12
  @st.cache_resource
13
  def load_model():
14
+ # Ensure no GPU (CUDA) optimizations like quantization
15
+ model = AutoModelForCausalLM.from_pretrained("abhiyanta/chatDoctor", use_cache=True)
16
  tokenizer = AutoTokenizer.from_pretrained("abhiyanta/chatDoctor")
17
  return model, tokenizer
18
 
 
34
  ""
35
  )
36
 
37
+ # Tokenize and ensure it's on CPU
38
  inputs = tokenizer([formatted_prompt], return_tensors="pt").to("cpu")
39
 
40
  # Stream the generated output
 
49
 
50
  # Footer
51
  st.markdown("---")
52
+ st.caption("Powered by Hugging Face 🤗")