calebdevans commited on
Commit
7ec313c
·
unverified ·
1 Parent(s): 74b49f8

remove CUDA checks from startup for ZeroGPU compatibility

Browse files
Files changed (3) hide show
  1. README.md +1 -0
  2. app.py +2 -3
  3. app_test.py +24 -0
README.md CHANGED
@@ -9,6 +9,7 @@ app_file: app.py
9
  pinned: false
10
  license: apache-2.0
11
  short_description: Find anomalies in logs using AI. Paste logs, get insights.
 
12
  tags:
13
  - log-analysis
14
  - anomaly-detection
 
9
  pinned: false
10
  license: apache-2.0
11
  short_description: Find anomalies in logs using AI. Paste logs, get insights.
12
+ hardware: zero-gpu
13
  tags:
14
  - log-analysis
15
  - anomaly-detection
app.py CHANGED
@@ -338,14 +338,13 @@ result = analyzer.analyze_file(Path("system.log"))
338
 
339
 
340
  # Startup logging
 
341
  logger.info("=" * 60)
342
  logger.info("Cordon Space starting...")
343
  logger.info(f"Python version: {sys.version}")
344
  logger.info(f"Gradio version: {gr.__version__}")
345
  logger.info(f"PyTorch version: {torch.__version__}")
346
- logger.info(f"CUDA available: {torch.cuda.is_available()}")
347
- if torch.cuda.is_available():
348
- logger.info(f"CUDA device: {torch.cuda.get_device_name(0)}")
349
  logger.info("=" * 60)
350
 
351
  # Create and launch the demo
 
338
 
339
 
340
  # Startup logging
341
+ # NOTE: Do NOT check torch.cuda here - ZeroGPU only allocates GPU inside @spaces.GPU functions
342
  logger.info("=" * 60)
343
  logger.info("Cordon Space starting...")
344
  logger.info(f"Python version: {sys.version}")
345
  logger.info(f"Gradio version: {gr.__version__}")
346
  logger.info(f"PyTorch version: {torch.__version__}")
347
+ logger.info("CUDA check deferred to @spaces.GPU function (ZeroGPU)")
 
 
348
  logger.info("=" * 60)
349
 
350
  # Create and launch the demo
app_test.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Minimal test app to verify Gradio 6 + HF Spaces works
3
+ """
4
+ import sys
5
+ print("=" * 60, flush=True)
6
+ print("TEST APP STARTING", flush=True)
7
+ print(f"Python: {sys.version}", flush=True)
8
+
9
+ import gradio as gr
10
+ print(f"Gradio imported: {gr.__version__}", flush=True)
11
+
12
+ import torch
13
+ print(f"PyTorch imported: {torch.__version__}", flush=True)
14
+ print(f"CUDA available: {torch.cuda.is_available()}", flush=True)
15
+
16
+ # Simple interface
17
+ with gr.Blocks() as demo:
18
+ gr.Markdown("# Test App Running!")
19
+ gr.Textbox(label="If you see this, the app works!")
20
+
21
+ print("Launching...", flush=True)
22
+ demo.launch(server_name="0.0.0.0", server_port=7860)
23
+ print("LAUNCHED!", flush=True)
24
+