AnimeOverlord commited on
Commit
4874ac3
·
1 Parent(s): a9406f3

still initial commit

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -8,14 +8,17 @@ from fastrtc import WebRTC, get_cloudflare_turn_credentials
8
  # Environment control flag to swap pipelines from the HF Space configuration dashboard
9
  USE_GPU_INFERENCE = os.getenv("USE_GPU_INFERENCE", "false").lower() == "true"
10
 
11
- # Connect to your deployed serverless backend running on Modal
12
  try:
13
  if USE_GPU_INFERENCE:
14
  print("🚀 Mode: Full GPU FLUX.2 Klein Inference")
15
- voxel_backend = modal.Function.lookup("flux-klein-voxel-backend", "VoxelModel.process_frame")
 
 
16
  else:
17
  print("🏎️ Mode: Zero-latency WebRTC Passthrough Demo")
18
- voxel_backend = modal.Function.lookup("flux-klein-voxel-backend", "demo_stream_frame")
 
19
  except Exception as e:
20
  print(f"⚠️ Could not bind Modal backend function layout: {e}")
21
  voxel_backend = None
@@ -77,8 +80,9 @@ custom_css = """
77
  # --- GRADIO INTERFACE ARCHITECTURE ---
78
  with gr.Blocks(css=custom_css, title="Minecraft Spatial Voxel Filter") as demo:
79
 
80
- with gr.Div(elem_id="container"):
81
- with gr.Div(elem_classes="header-text"):
 
82
  gr.Markdown("# ⛏️ MINECRAFT SPATIAL VOXEL FILTER ⛏️")
83
  gr.Markdown("Transform your physical environment into an interactive, real-time 3D blocky landscape running on FLUX.2 Klein.")
84
 
 
8
  # Environment control flag to swap pipelines from the HF Space configuration dashboard
9
  USE_GPU_INFERENCE = os.getenv("USE_GPU_INFERENCE", "false").lower() == "true"
10
 
11
+ # Connect to your deployed serverless backend running on Modal using 1.0+ SDK syntax
12
  try:
13
  if USE_GPU_INFERENCE:
14
  print("🚀 Mode: Full GPU FLUX.2 Klein Inference")
15
+ # Modern Class binding syntax for Modal 1.0+
16
+ voxel_model_cls = modal.Cls.from_name("flux-klein-voxel-backend", "VoxelModel")
17
+ voxel_backend = voxel_model_cls().process_frame
18
  else:
19
  print("🏎️ Mode: Zero-latency WebRTC Passthrough Demo")
20
+ # Modern Standalone function lookup syntax for Modal 1.0+
21
+ voxel_backend = modal.Function.from_name("flux-klein-voxel-backend", "demo_stream_frame")
22
  except Exception as e:
23
  print(f"⚠️ Could not bind Modal backend function layout: {e}")
24
  voxel_backend = None
 
80
  # --- GRADIO INTERFACE ARCHITECTURE ---
81
  with gr.Blocks(css=custom_css, title="Minecraft Spatial Voxel Filter") as demo:
82
 
83
+ # gr.Group behaves exactly like a <div> tag container for CSS styling wrappers
84
+ with gr.Group(elem_id="container"):
85
+ with gr.Group(elem_classes="header-text"):
86
  gr.Markdown("# ⛏️ MINECRAFT SPATIAL VOXEL FILTER ⛏️")
87
  gr.Markdown("Transform your physical environment into an interactive, real-time 3D blocky landscape running on FLUX.2 Klein.")
88