Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,13 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
|
3 |
|
4 |
# Load the model and tokenizer
|
5 |
tokenizer = AutoTokenizer.from_pretrained("umar141/Gemma_1B_Baro_v2_vllm")
|
6 |
-
model = AutoModelForCausalLM.from_pretrained(
|
|
|
|
|
|
|
7 |
|
8 |
# Streamlit page configuration
|
9 |
st.set_page_config(page_title="Gemma-based Chatbot", page_icon=":robot:")
|
@@ -27,4 +31,3 @@ if user_input:
|
|
27 |
# Display the response
|
28 |
st.write("AI Response:")
|
29 |
st.write(response)
|
30 |
-
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
3 |
+
import torch
|
4 |
|
5 |
# Load the model and tokenizer
|
6 |
tokenizer = AutoTokenizer.from_pretrained("umar141/Gemma_1B_Baro_v2_vllm")
|
7 |
+
model = AutoModelForCausalLM.from_pretrained(
|
8 |
+
"umar141/Gemma_1B_Baro_v2_vllm",
|
9 |
+
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32 # Use float16 if GPU is available, else float32
|
10 |
+
)
|
11 |
|
12 |
# Streamlit page configuration
|
13 |
st.set_page_config(page_title="Gemma-based Chatbot", page_icon=":robot:")
|
|
|
31 |
# Display the response
|
32 |
st.write("AI Response:")
|
33 |
st.write(response)
|
|