Spaces:
Running on Zero
Running on Zero
Explicit CPU default and GPU selector
Browse files
app.py
CHANGED
|
@@ -9,6 +9,13 @@ def cpu_smoke():
|
|
| 9 |
def gpu_smoke():
|
| 10 |
return run_probe(True)
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
with gr.Blocks() as demo:
|
| 13 |
gr.Markdown('''# AI Learns To Drive — private compute test
|
| 14 |
Simulator by [Zorro909](https://github.com/Zorro909/driving_sim_rs).
|
|
@@ -19,7 +26,9 @@ GPU uses up to 90 seconds of included allowance; check quota first. No automatic
|
|
| 19 |
No user uploads; temporary model files are deleted before the receipt is returned.
|
| 20 |
This tests backend execution, not useful learning, performance, or full UI integration.
|
| 21 |
''')
|
|
|
|
| 22 |
report=gr.JSON(label='Execution receipt')
|
|
|
|
| 23 |
gr.Button('Run CPU-only test').click(cpu_smoke,outputs=report,api_name='cpu_smoke',concurrency_limit=1,concurrency_id='native')
|
| 24 |
gr.Button('Run GPU test').click(gpu_smoke,outputs=report,api_name='gpu_smoke',concurrency_limit=1,concurrency_id='native')
|
| 25 |
|
|
|
|
| 9 |
def gpu_smoke():
|
| 10 |
return run_probe(True)
|
| 11 |
|
| 12 |
+
def selected_smoke(backend):
|
| 13 |
+
if backend == 'cpu':
|
| 14 |
+
return cpu_smoke()
|
| 15 |
+
if backend == 'gpu':
|
| 16 |
+
return gpu_smoke()
|
| 17 |
+
raise ValueError('Choose CPU or GPU')
|
| 18 |
+
|
| 19 |
with gr.Blocks() as demo:
|
| 20 |
gr.Markdown('''# AI Learns To Drive — private compute test
|
| 21 |
Simulator by [Zorro909](https://github.com/Zorro909/driving_sim_rs).
|
|
|
|
| 26 |
No user uploads; temporary model files are deleted before the receipt is returned.
|
| 27 |
This tests backend execution, not useful learning, performance, or full UI integration.
|
| 28 |
''')
|
| 29 |
+
backend=gr.Radio(choices=[('CPU — no GPU allowance needed','cpu'),('GPU — uses included GPU allowance','gpu')],value='cpu',label='Compute')
|
| 30 |
report=gr.JSON(label='Execution receipt')
|
| 31 |
+
gr.Button('Run selected backend',variant='primary').click(selected_smoke,inputs=backend,outputs=report,api_name='selected_smoke',concurrency_limit=1,concurrency_id='native')
|
| 32 |
gr.Button('Run CPU-only test').click(cpu_smoke,outputs=report,api_name='cpu_smoke',concurrency_limit=1,concurrency_id='native')
|
| 33 |
gr.Button('Run GPU test').click(gpu_smoke,outputs=report,api_name='gpu_smoke',concurrency_limit=1,concurrency_id='native')
|
| 34 |
|