Raghu commited on
Commit
0f1f004
·
1 Parent(s): f83c4f6

Fix HF Spaces runtime error

Browse files

- Set gradio demo.launch to share=True with queue and server_name/port
- Pin gradio to 4.29.0 to avoid json_schema bool error

Files changed (2) hide show
  1. app.py +7 -2
  2. requirements.txt +2 -1
app.py CHANGED
@@ -708,7 +708,12 @@ with gr.Blocks(title="Receipt Processing Agent", theme=gr.themes.Soft(), css=CUS
708
  """)
709
 
710
 
711
- # Launch
712
  if __name__ == "__main__":
713
- demo.launch()
 
 
 
 
 
714
 
 
708
  """)
709
 
710
 
711
+ # Launch (Spaces needs share=True when localhost is blocked)
712
  if __name__ == "__main__":
713
+ demo.queue(max_size=8).launch(
714
+ share=True,
715
+ server_name="0.0.0.0",
716
+ server_port=7860,
717
+ show_error=True,
718
+ )
719
 
requirements.txt CHANGED
@@ -2,7 +2,8 @@ torch>=2.0.0
2
  torchvision>=0.15.0
3
  transformers>=4.30.0
4
  easyocr>=1.7.0
5
- gradio>=4.0.0
 
6
  Pillow>=9.0.0
7
  numpy>=1.21.0
8
  scikit-learn>=1.0.0
 
2
  torchvision>=0.15.0
3
  transformers>=4.30.0
4
  easyocr>=1.7.0
5
+ # Pin gradio to a stable version to avoid json_schema issues in Spaces
6
+ gradio==4.29.0
7
  Pillow>=9.0.0
8
  numpy>=1.21.0
9
  scikit-learn>=1.0.0