tyfsadik commited on
Commit
8d43e39
·
verified ·
1 Parent(s): 61d8dce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -1
app.py CHANGED
@@ -15,7 +15,24 @@ Models Used (in ensemble pipeline):
15
  Author: Advanced Humanizer Pipeline
16
  Space Hardware: GPU A100 (paid config)
17
  """
 
 
 
 
 
 
 
18
 
 
 
 
 
 
 
 
 
 
 
19
  import os
20
  import re
21
  import json
@@ -1462,7 +1479,13 @@ def main():
1462
 
1463
  app = HumanizerApp()
1464
  interface = app.build_interface()
1465
- interface.queue(default_concurrency_limit=2).launch()
 
 
 
 
 
 
1466
 
1467
 
1468
  if __name__ == "__main__":
 
15
  Author: Advanced Humanizer Pipeline
16
  Space Hardware: GPU A100 (paid config)
17
  """
18
+ import gradio as gr
19
+
20
+ # Temporary workaround for Gradio/Jinja template cache crash on Spaces
21
+ try:
22
+ from jinja2.utils import LRUCache as _LRUCache
23
+
24
+ _orig_lru_get = _LRUCache.get
25
 
26
+ def _safe_lru_get(self, key, default=None):
27
+ try:
28
+ return _orig_lru_get(self, key, default)
29
+ except TypeError:
30
+ return default
31
+
32
+ _LRUCache.get = _safe_lru_get
33
+ print("✅ jinja2 LRUCache patch applied")
34
+ except Exception as e:
35
+ print(f"⚠️ jinja2 patch not applied: {e}")
36
  import os
37
  import re
38
  import json
 
1479
 
1480
  app = HumanizerApp()
1481
  interface = app.build_interface()
1482
+
1483
+ interface.queue(default_concurrency_limit=2).launch(
1484
+ server_name="0.0.0.0",
1485
+ server_port=int(os.environ.get("PORT", 7860)),
1486
+ share=True,
1487
+ show_error=True,
1488
+ )
1489
 
1490
 
1491
  if __name__ == "__main__":