Spaces:
Paused
Paused
0x7o
commited on
Commit
•
9a26d37
1
Parent(s):
8e337b5
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
|
|
3 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
4 |
from transformers import StoppingCriteria, StoppingCriteriaList, TextIteratorStreamer
|
5 |
from threading import Thread
|
@@ -20,6 +21,7 @@ class StopOnTokens(StoppingCriteria):
|
|
20 |
|
21 |
|
22 |
# Function to generate model predictions.
|
|
|
23 |
def predict(message, history):
|
24 |
history_transformer_format = history + [[message, ""]]
|
25 |
stop = StopOnTokens()
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
+
import spaces
|
4 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
5 |
from transformers import StoppingCriteria, StoppingCriteriaList, TextIteratorStreamer
|
6 |
from threading import Thread
|
|
|
21 |
|
22 |
|
23 |
# Function to generate model predictions.
|
24 |
+
@spaces.GPU
|
25 |
def predict(message, history):
|
26 |
history_transformer_format = history + [[message, ""]]
|
27 |
stop = StopOnTokens()
|