Update app.py
Browse files
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 |
-
|
|
|
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
|
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 🤗
|
|
|
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 🤗")
|