acecalisto3 commited on
Commit
0cb2fcb
·
verified ·
1 Parent(s): 00b6a8c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -30
app.py CHANGED
@@ -22,7 +22,7 @@ warnings.filterwarnings('ignore', category=UserWarning, module='__main__')
22
  os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
23
 
24
  @spaces.GPU
25
- def initialize_environment():
26
  """Initialize application environment and configurations"""
27
  directories = ['logs', 'resolutions', 'repos']
28
  for directory in directories:
@@ -234,7 +234,7 @@ custom_css = """
234
  }
235
  """
236
 
237
- def create_gradio_interface():
238
  """Create and configure Gradio interface with custom styling"""
239
  bot = GitHubBot()
240
 
@@ -367,31 +367,7 @@ if __name__ == "__main__":
367
  signal.signal(signal.SIGINT, signal_handler)
368
  signal.signal(signal.SIGTERM, signal_handler)
369
 
370
- try:
371
- # Create and launch interface
372
- demo = create_gradio_interface()
373
-
374
- # Configure launch parameters
375
- is_on_spaces = os.getenv("SPACE_ID") is not None
376
- launch_kwargs = {
377
- "server_name": "0.0.0.0",
378
- "server_port": 7860,
379
- "debug": True,
380
- }
381
-
382
- if not is_on_spaces:
383
- launch_kwargs["share"] = True
384
- logger.info("Running in local mode with public URL enabled")
385
- else:
386
- logger.info("Running on Hugging Face Spaces")
387
-
388
- # Launch application
389
- logger.info("Launching Gradio interface...")
390
- demo = demo.queue()
391
- demo.launch(**launch_kwargs)
392
-
393
- except Exception as e:
394
- logger.error(f"Error launching application: {str(e)}")
395
- raise
396
- finally:
397
- logger.info("Application shutdown")
 
22
  os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
23
 
24
  @spaces.GPU
25
+ def initialize_environment(input_file, output_directory):
26
  """Initialize application environment and configurations"""
27
  directories = ['logs', 'resolutions', 'repos']
28
  for directory in directories:
 
234
  }
235
  """
236
 
237
+ def create_gradio_interface(input_file, output_directory):
238
  """Create and configure Gradio interface with custom styling"""
239
  bot = GitHubBot()
240
 
 
367
  signal.signal(signal.SIGINT, signal_handler)
368
  signal.signal(signal.SIGTERM, signal_handler)
369
 
370
+ input_file = "path/to/input/file"
371
+ output_directory = "path/to/output/directory"
372
+ demo = create_gradio_interface(input_file, output_directory)
373
+ demo.launch()