armansakif commited on
Commit
6f75d60
1 Parent(s): 091bc7c

huggingface do not have cuda

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -3,8 +3,10 @@ import torch
3
 
4
  if torch.cuda.is_available():
5
  device = torch.device("cuda")
 
6
  else:
7
  device = torch.device("cpu")
 
8
 
9
  import numpy as np
10
  import gradio as gr
@@ -22,7 +24,7 @@ model = BertForSequenceClassification.from_pretrained(
22
  output_attentions = False, # Whether the model returns attentions weights.
23
  output_hidden_states = False, # Whether the model returns all hidden-states.
24
  )
25
- model.cuda()
26
 
27
  def classify_news(news):
28
  label_list = []
 
3
 
4
  if torch.cuda.is_available():
5
  device = torch.device("cuda")
6
+ print('We will use the GPU:', torch.cuda.get_device_name(0))
7
  else:
8
  device = torch.device("cpu")
9
+ print('No GPU available, using the CPU instead.')
10
 
11
  import numpy as np
12
  import gradio as gr
 
24
  output_attentions = False, # Whether the model returns attentions weights.
25
  output_hidden_states = False, # Whether the model returns all hidden-states.
26
  )
27
+ # model.cuda()
28
 
29
  def classify_news(news):
30
  label_list = []