Spaces:
Sleeping
Sleeping
Commit
·
d615911
1
Parent(s):
6b8f9d0
fix bug
Browse files- app.py +4 -1
- requirements.txt +2 -1
app.py
CHANGED
@@ -1,7 +1,10 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
|
|
|
|
|
5 |
|
6 |
async def process(text):
|
7 |
return await sentiment_pipeline(text)
|
|
|
1 |
import gradio as gr
|
2 |
+
import torch
|
3 |
from transformers import pipeline
|
4 |
|
5 |
+
device = 0 if torch.cuda.is_available() else -1
|
6 |
+
|
7 |
+
sentiment_pipeline = pipeline("sentiment-analysis", device=device)
|
8 |
|
9 |
async def process(text):
|
10 |
return await sentiment_pipeline(text)
|
requirements.txt
CHANGED
@@ -1 +1,2 @@
|
|
1 |
-
transformers
|
|
|
|
1 |
+
transformers
|
2 |
+
torch
|