feng2022 commited on
Commit
52a149c
·
1 Parent(s): 083318f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -17,7 +17,7 @@ def print_gpu_utilization():
17
  nvmlInit()
18
  handle = nvmlDeviceGetHandleByIndex(0)
19
  info = nvmlDeviceGetMemoryInfo(handle)
20
- print(f"GPU memory occupied: {info.used//1024**2} MB.")
21
 
22
 
23
  def print_summary(result):
@@ -31,12 +31,12 @@ dummy_data = {
31
  }
32
  ds = Dataset.from_dict(dummy_data)
33
  ds.set_format("pt")
34
-
35
  iface = gr.Interface(
36
  fn=predict,
37
  inputs='text',
38
  outputs='text',
39
- examples=[[f'result']]
40
  )
41
 
42
  iface.launch()
 
17
  nvmlInit()
18
  handle = nvmlDeviceGetHandleByIndex(0)
19
  info = nvmlDeviceGetMemoryInfo(handle)
20
+ return f"GPU memory occupied: {info.used//1024**2} MB."
21
 
22
 
23
  def print_summary(result):
 
31
  }
32
  ds = Dataset.from_dict(dummy_data)
33
  ds.set_format("pt")
34
+ result = print_gpu_utilization()
35
  iface = gr.Interface(
36
  fn=predict,
37
  inputs='text',
38
  outputs='text',
39
+ examples=[f'{result}']
40
  )
41
 
42
  iface.launch()