Frenchizer commited on
Commit
b6dbd97
·
1 Parent(s): 9d30915

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -8,7 +8,7 @@ session = ort.InferenceSession(MODEL_FILE)
8
  tokenizer = AutoTokenizer.from_pretrained("Helsinki-NLP/opus-mt-en-fr")
9
 
10
  labels = [
11
- "general", "pharma", "legal", "technical", "UI", "medicine", "it", "marketing",
12
  "e-commerce", "programming", "website", "html", "keywords", "food commerce",
13
  "personal development", "literature", "poetry", "physics", "chemistry", "biology",
14
  "theater", "finance", "sports", "education", "politics", "economics", "art",
@@ -24,7 +24,7 @@ context_pipeline = pipeline("zero-shot-classification", model="facebook/bart-lar
24
  def detect_context(input_text):
25
  result = context_pipeline(input_text, candidate_labels=labels)
26
  contexts = [label for label, score in zip(result["labels"], result["scores"]) if score > 0.1]
27
- print contexts
28
  return contexts if contexts else ["general"]
29
 
30
  def translate_text(input_text, context):
 
8
  tokenizer = AutoTokenizer.from_pretrained("Helsinki-NLP/opus-mt-en-fr")
9
 
10
  labels = [
11
+ "general", "pharma", "legal", "technical", "UI", "user interface", "medicine", "information technology", "IT", "marketing",
12
  "e-commerce", "programming", "website", "html", "keywords", "food commerce",
13
  "personal development", "literature", "poetry", "physics", "chemistry", "biology",
14
  "theater", "finance", "sports", "education", "politics", "economics", "art",
 
24
  def detect_context(input_text):
25
  result = context_pipeline(input_text, candidate_labels=labels)
26
  contexts = [label for label, score in zip(result["labels"], result["scores"]) if score > 0.1]
27
+ print(contexts)
28
  return contexts if contexts else ["general"]
29
 
30
  def translate_text(input_text, context):