Spaces:
Running
on
Zero
Running
on
Zero
Locutusque
commited on
Commit
•
3d0fb66
1
Parent(s):
b87f04a
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline, AutoTokenizer
|
3 |
import torch
|
|
|
4 |
|
|
|
5 |
def load_model(model_name):
|
6 |
return pipeline("text-generation", model=model_name, device="cuda", torch_dtype=torch.float16)
|
7 |
-
|
8 |
def generate(
|
9 |
model_name,
|
10 |
user_input,
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline, AutoTokenizer
|
3 |
import torch
|
4 |
+
import spaces
|
5 |
|
6 |
+
@spaces.GPU
|
7 |
def load_model(model_name):
|
8 |
return pipeline("text-generation", model=model_name, device="cuda", torch_dtype=torch.float16)
|
9 |
+
@spaces.GPU
|
10 |
def generate(
|
11 |
model_name,
|
12 |
user_input,
|