Frenchizer commited on
Commit
b55eab0
·
1 Parent(s): 6f6ca80

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -1,4 +1,13 @@
1
  import gradio as gr
 
 
 
 
 
 
 
 
 
2
  "general", "pharma", "legal", "technical", "UI", "medicine", "it", "marketing",
3
  "e-commerce", "programming", "website", "html", "keywords", "food commerce",
4
  "personal development", "literature", "poetry", "physics", "chemistry", "biology",
@@ -52,10 +61,4 @@ def process_request(input_text):
52
  context = detect_context(input_text)
53
  translation = translate_text(input_text)
54
  return translation, context
55
-
56
- gr.Interface(
57
- fn=process_request,
58
- inputs="text",
59
- outputs="text",
60
- live=True
61
  ).launch()
 
1
  import gradio as gr
2
+ import onnxruntime as ort
3
+ from transformers import AutoTokenizer, pipeline
4
+ import numpy as np
5
+
6
+ MODEL_FILE = "./model.onnx"
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",
 
61
  context = detect_context(input_text)
62
  translation = translate_text(input_text)
63
  return translation, context
 
 
 
 
 
 
64
  ).launch()