Spaces:
Build error
Build error
Commit
·
ed0975c
1
Parent(s):
b6dbd97
Update app.py
Browse files
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",
|
| 12 |
-
"
|
| 13 |
-
"
|
| 14 |
-
"
|
| 15 |
-
"
|
| 16 |
-
"
|
| 17 |
-
"
|
|
|
|
| 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
|
| 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,
|