Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 3 |
import torch
|
|
|
|
| 4 |
|
| 5 |
model_id = "tiiuae/falcon-rw-1b"
|
| 6 |
|
|
@@ -9,6 +10,7 @@ tokenizer = AutoTokenizer.from_pretrained(model_id)
|
|
| 9 |
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float32)
|
| 10 |
|
| 11 |
# Chat logic
|
|
|
|
| 12 |
def chat_with_bot(user_input, history):
|
| 13 |
history = history or []
|
| 14 |
prompt = ""
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 3 |
import torch
|
| 4 |
+
import spaces
|
| 5 |
|
| 6 |
model_id = "tiiuae/falcon-rw-1b"
|
| 7 |
|
|
|
|
| 10 |
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float32)
|
| 11 |
|
| 12 |
# Chat logic
|
| 13 |
+
@spaces.GPU
|
| 14 |
def chat_with_bot(user_input, history):
|
| 15 |
history = history or []
|
| 16 |
prompt = ""
|