Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
|
|
|
3 |
|
4 |
# Load model with 8-bit precision
|
5 |
model_name = "yasserrmd/SmolLM2-156M-synthetic-dlp"
|
6 |
model = AutoModelForCausalLM.from_pretrained(
|
7 |
-
model_name,
|
8 |
load_in_8bit=True
|
9 |
)
|
10 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
@@ -16,6 +17,7 @@ generator = pipeline(
|
|
16 |
tokenizer=tokenizer
|
17 |
)
|
18 |
|
|
|
19 |
def chat_assistant(chat_history, user_input):
|
20 |
"""Generate a response based on user input and chat history."""
|
21 |
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
|
3 |
+
import spaces
|
4 |
|
5 |
# Load model with 8-bit precision
|
6 |
model_name = "yasserrmd/SmolLM2-156M-synthetic-dlp"
|
7 |
model = AutoModelForCausalLM.from_pretrained(
|
8 |
+
model_name,
|
9 |
load_in_8bit=True
|
10 |
)
|
11 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
|
|
17 |
tokenizer=tokenizer
|
18 |
)
|
19 |
|
20 |
+
@spaces.GPU
|
21 |
def chat_assistant(chat_history, user_input):
|
22 |
"""Generate a response based on user input and chat history."""
|
23 |
|