fruitpicker01 commited on
Commit
7f4546c
1 Parent(s): b20038f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -19,6 +19,7 @@ import io
19
  from transformers import AutoTokenizer, AutoModel
20
  from utils import best_text_choice
21
  import asyncio
 
22
 
23
  tokenizer = AutoTokenizer.from_pretrained("ai-forever/ru-en-RoSBERTa")
24
  model = AutoModel.from_pretrained("ai-forever/ru-en-RoSBERTa")
@@ -1611,7 +1612,10 @@ async def check_product_name_consistency(message, product_name):
1611
 
1612
  async def safe_check(func, *args):
1613
  try:
1614
- return await func(*args)
 
 
 
1615
  except Exception as e:
1616
  print(f"Error in {func.__name__}: {e}")
1617
  return None
 
19
  from transformers import AutoTokenizer, AutoModel
20
  from utils import best_text_choice
21
  import asyncio
22
+ import inspect
23
 
24
  tokenizer = AutoTokenizer.from_pretrained("ai-forever/ru-en-RoSBERTa")
25
  model = AutoModel.from_pretrained("ai-forever/ru-en-RoSBERTa")
 
1612
 
1613
  async def safe_check(func, *args):
1614
  try:
1615
+ if inspect.iscoroutinefunction(func):
1616
+ return await func(*args)
1617
+ else:
1618
+ return func(*args)
1619
  except Exception as e:
1620
  print(f"Error in {func.__name__}: {e}")
1621
  return None