feng2022 commited on
Commit
71264e4
·
1 Parent(s): 8e4bac4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -52,6 +52,11 @@ def predict(text):
52
  return pipe(text)[0]["translation_text"]
53
 
54
  def main():
 
 
 
 
 
55
  if torch.cuda.is_available():
56
  result = "True"
57
  else:
@@ -61,7 +66,7 @@ def main():
61
  fn=predict,
62
  inputs='text',
63
  outputs='text',
64
- examples=[[result]]
65
  )
66
 
67
  iface.launch()
 
52
  return pipe(text)[0]["translation_text"]
53
 
54
  def main():
55
+ torch.cuda.init()
56
+ if torch.cuda.is_initialized():
57
+ ini = "True"
58
+ else:
59
+ ini = "False"
60
  if torch.cuda.is_available():
61
  result = "True"
62
  else:
 
66
  fn=predict,
67
  inputs='text',
68
  outputs='text',
69
+ examples=[[f'{ini} {result}']]
70
  )
71
 
72
  iface.launch()