Frenchizer commited on
Commit
3483f4c
·
1 Parent(s): ea96e93

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -20,13 +20,13 @@ labels = [
20
  ]
21
 
22
  context_pipeline = pipeline("zero-shot-classification", model="MoritzLaurer/deberta-v3-base-mnli-fever-anli")
23
-
24
 
25
  def detect_context(input_text):
26
  result = context_pipeline(input_text, candidate_labels=labels)
27
  contexts = [label for label, score in zip(result["labels"], result["scores"]) if label in labels and score > 0.1]
28
  print(contexts)
29
- return contexts if contexts else ["general"]
30
 
31
 
32
  def translate_text(input_text, context):
@@ -72,4 +72,4 @@ gr.Interface(
72
  inputs="text",
73
  outputs="text",
74
  live=True
75
- ).launch()
 
20
  ]
21
 
22
  context_pipeline = pipeline("zero-shot-classification", model="MoritzLaurer/deberta-v3-base-mnli-fever-anli")
23
+ #context_pipeline = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
24
 
25
  def detect_context(input_text):
26
  result = context_pipeline(input_text, candidate_labels=labels)
27
  contexts = [label for label, score in zip(result["labels"], result["scores"]) if label in labels and score > 0.1]
28
  print(contexts)
29
+ return contexts or ["general"]
30
 
31
 
32
  def translate_text(input_text, context):
 
72
  inputs="text",
73
  outputs="text",
74
  live=True
75
+ ).launch()