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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -8,13 +8,14 @@ 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", "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",
15
- "history", "music", "gaming", "aerospace", "engineering", "robotics", "travel",
16
- "tourism", "healthcare", "psychology", "environment", "fashion", "design",
17
- "real estate", "retail", "news", "entertainment", "social media", "automotive",
 
18
  "machine learning", "cryptocurrency", "blockchain", "philosophy", "anthropology",
19
  "archaeology", "data science"
20
  ]
@@ -61,7 +62,7 @@ def translate_text(input_text, context):
61
  def process_request(input_text):
62
  contexts = detect_context(input_text)
63
  translation = translate_text(input_text, contexts[0]) # Use the first detected context
64
- return translation, contexts[0]
65
 
66
  gr.Interface(
67
  fn=process_request,
 
8
  tokenizer = AutoTokenizer.from_pretrained("Helsinki-NLP/opus-mt-en-fr")
9
 
10
  labels = [
11
+ "general", "pharma", "legal", "technical", "UI", "user interface", "medicine",
12
+ "information technology", "IT", "marketing", "e-commerce", "programming",
13
+ "website", "html", "keywords", "food commerce", "personal development",
14
+ "literature", "poetry", "physics", "chemistry", "biology", "theater", "finance",
15
+ "sports", "education", "politics", "economics", "art", "history", "music",
16
+ "gaming", "aerospace", "engineering", "robotics", "travel", "tourism",
17
+ "healthcare", "psychology", "environment", "fashion", "design", "real estate",
18
+ "retail", "news", "entertainment", "social media", "automotive", "AI",
19
  "machine learning", "cryptocurrency", "blockchain", "philosophy", "anthropology",
20
  "archaeology", "data science"
21
  ]
 
62
  def process_request(input_text):
63
  contexts = detect_context(input_text)
64
  translation = translate_text(input_text, contexts[0]) # Use the first detected context
65
+ return translation
66
 
67
  gr.Interface(
68
  fn=process_request,