Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ def print_gpu_utilization():
|
|
17 |
nvmlInit()
|
18 |
handle = nvmlDeviceGetHandleByIndex(0)
|
19 |
info = nvmlDeviceGetMemoryInfo(handle)
|
20 |
-
|
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=[
|
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()
|