Spaces:
Sleeping
Sleeping
marufc36
commited on
Commit
·
4b23361
1
Parent(s):
7bb9c0a
app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
|
5 |
|
6 |
pipe = pipeline("text-generation", model="poem_generator2", device=device)
|
7 |
|
|
|
1 |
import gradio as gr
|
2 |
+
import torch
|
3 |
from transformers import pipeline
|
4 |
|
5 |
+
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
|
6 |
|
7 |
pipe = pipeline("text-generation", model="poem_generator2", device=device)
|
8 |
|