rongo1 commited on
Commit
0c68bd6
·
1 Parent(s): 1fe0c11

fix: init issue

Browse files
Files changed (2) hide show
  1. app.py +5 -13
  2. business_cards/.gitkeep +2 -3
app.py CHANGED
@@ -13,11 +13,11 @@ import sys
13
  import shutil
14
 
15
  # Configure logging
 
16
  logging.basicConfig(
17
  level=logging.INFO,
18
  format='%(asctime)s - %(levelname)s - %(funcName)s:%(lineno)d - %(message)s',
19
  handlers=[
20
- logging.FileHandler('business_card_extractor.log'),
21
  logging.StreamHandler(sys.stdout)
22
  ]
23
  )
@@ -525,7 +525,7 @@ with gr.Blocks(title="Business Card Data Extractor") as demo:
525
  image_input = gr.File(
526
  label="Upload Business Cards",
527
  file_count="multiple",
528
- file_types=["image"]
529
  )
530
 
531
  model_selector = gr.Dropdown(
@@ -582,14 +582,6 @@ with gr.Blocks(title="Business Card Data Extractor") as demo:
582
  """
583
  )
584
 
585
- if __name__ == "__main__":
586
- logger.info("Starting Gradio demo")
587
- try:
588
- demo.launch()
589
- except KeyboardInterrupt:
590
- logger.info("Application stopped by user (Ctrl+C)")
591
- except Exception as e:
592
- logger.error(f"Application crashed: {e}")
593
- raise
594
- finally:
595
- logger.info("Application shutdown complete")
 
13
  import shutil
14
 
15
  # Configure logging
16
+ # Simplified logging for cloud deployment
17
  logging.basicConfig(
18
  level=logging.INFO,
19
  format='%(asctime)s - %(levelname)s - %(funcName)s:%(lineno)d - %(message)s',
20
  handlers=[
 
21
  logging.StreamHandler(sys.stdout)
22
  ]
23
  )
 
525
  image_input = gr.File(
526
  label="Upload Business Cards",
527
  file_count="multiple",
528
+ file_types=[".jpg", ".jpeg", ".png", ".webp", ".bmp"]
529
  )
530
 
531
  model_selector = gr.Dropdown(
 
582
  """
583
  )
584
 
585
+ # Launch for Hugging Face Spaces deployment
586
+ logger.info("Starting Gradio demo")
587
+ demo.launch(share=False)
 
 
 
 
 
 
 
 
business_cards/.gitkeep CHANGED
@@ -1,3 +1,2 @@
1
- # This file ensures the business_cards directory is created in the repository
2
- # Business card images will be saved here when the "Save Images" option is enabled
3
- # Files in this directory are ignored by git (see .gitignore) except for this .gitkeep file
 
1
+ # This file ensures the business_cards directory is created and tracked by git
2
+ # Business card images will be saved here when the app runs