sharifIslam commited on
Commit
9cac8ab
·
1 Parent(s): 2cc2d33

Fix HuggingFace Spaces deployment configuration

Browse files
Files changed (4) hide show
  1. app.py +3 -3
  2. config.py +0 -5
  3. gradio_ui.py +5 -1
  4. pipeline.py +1 -1
app.py CHANGED
@@ -25,7 +25,7 @@ logger.info("Importing UI builder...")
25
  from gradio_ui import build_ui
26
 
27
  logger.info("Importing configuration...")
28
- from config import WEIGHTS_PATH, OUTPUT_DIR, SERVER_NAME, SERVER_PORT, SHARE, SHOW_ERROR
29
 
30
 
31
  def main():
@@ -45,8 +45,8 @@ def main():
45
  logger.info("UI built successfully!")
46
 
47
  logger.info("Launching application...")
48
- app.launch()
49
-
50
  logger.info("Application started!")
51
 
52
 
 
25
  from gradio_ui import build_ui
26
 
27
  logger.info("Importing configuration...")
28
+ from config import WEIGHTS_PATH, OUTPUT_DIR
29
 
30
 
31
  def main():
 
45
  logger.info("UI built successfully!")
46
 
47
  logger.info("Launching application...")
48
+ # HuggingFace Spaces automatically handles server configuration
49
+ app.queue().launch()
50
  logger.info("Application started!")
51
 
52
 
config.py CHANGED
@@ -14,8 +14,3 @@ DEFAULT_CONF_THRESHOLD = 0.001
14
 
15
  CONTRAST_ENHANCEMENT = 1.2
16
  SHARPNESS_ENHANCEMENT = 1.5
17
-
18
- SERVER_NAME = "0.0.0.0"
19
- SERVER_PORT = 7860
20
- SHARE = True
21
- SHOW_ERROR = True
 
14
 
15
  CONTRAST_ENHANCEMENT = 1.2
16
  SHARPNESS_ENHANCEMENT = 1.5
 
 
 
 
 
gradio_ui.py CHANGED
@@ -20,7 +20,11 @@ def build_ui(out_dir: str, model, device: str) -> gr.Blocks:
20
  css, fullscreen_js = load_assets()
21
  pipeline = functools.partial(run_pipeline, out_dir, model, device, IMAGE_SIZE)
22
 
23
- with gr.Blocks(title="Multi-View 3D Reconstruction (MV3DR)", css=css, theme=gr.themes.Base(), fill_width=True) as app:
 
 
 
 
24
  gr.Markdown("# Multi-View 3D Reconstruction (MV3DR)")
25
 
26
  with gr.Row():
 
20
  css, fullscreen_js = load_assets()
21
  pipeline = functools.partial(run_pipeline, out_dir, model, device, IMAGE_SIZE)
22
 
23
+ with gr.Blocks(
24
+ title="Multi-View 3D Reconstruction (MV3DR)",
25
+ css=css,
26
+ theme=gr.themes.Base()
27
+ ) as app:
28
  gr.Markdown("# Multi-View 3D Reconstruction (MV3DR)")
29
 
30
  with gr.Row():
pipeline.py CHANGED
@@ -17,7 +17,7 @@ from config import IMAGE_SIZE, DEFAULT_ITERATIONS
17
  def run_pipeline(outdir: str, model: torch.nn.Module, device: str, img_size: int,
18
  filelist: List[str], niter: int, as_pc: bool, refinement: bool,
19
  clean_depth: bool = True) -> Tuple[Optional[object], Optional[str], List]:
20
-
21
  if not filelist or len(filelist) == 0:
22
  return None, None, []
23
 
 
17
  def run_pipeline(outdir: str, model: torch.nn.Module, device: str, img_size: int,
18
  filelist: List[str], niter: int, as_pc: bool, refinement: bool,
19
  clean_depth: bool = True) -> Tuple[Optional[object], Optional[str], List]:
20
+
21
  if not filelist or len(filelist) == 0:
22
  return None, None, []
23