Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
anuvaad
OpenNMT-py
Commits
3e3bd411
Commit
3e3bd411
authored
4 years ago
by
aj7tesh
Browse files
Options
Download
Patches
Plain Diff
added readme_util
parent
fef87089
master
dependabot/pip/flask-cors-3.0.9
experiments
release_anuvaad
release_anuvaad_users
v1.0.0
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
kafka_utils/document_translator.py
+0
-44
kafka_utils/document_translator.py
translation_util/README_UTILS.md
+13
-0
translation_util/README_UTILS.md
with
13 additions
and
44 deletions
+13
-44
kafka_utils/document_translator.py
+
0
−
44
View file @
3e3bd411
from
kafka_utils.producer
import
get_producer
from
kafka_utils.consumer
import
get_consumer
import
json
import
anuvada
import
tools.sp_enc_dec
as
sp
import
ancillary_functions_anuvaad.ancillary_functions
as
ancillary_functions
import
ancillary_functions_anuvaad.sc_preface_handler
as
sc_preface_handler
...
...
@@ -65,46 +64,3 @@ def doc_translator(translation_server,c_topic,p_topic):
logger
.
error
(
"Unexpected error: %s"
%
sys
.
exc_info
()[
0
])
logger
.
error
(
"error in doc_translator: {}"
.
format
(
e
))
doc_translator
(
translation_server
,
c_topic
,
p_topic
)
# def nmt_translation(translation_server,c,p,producer_topic):
# iq =0
# out = {}
# msg_count = 0
# msg_sent = 0
# try:
# for msg in c:
# msg_count +=1
# logger.info("*******************msg receive count*********:{}".format(msg_count))
# iq = iq +1
# inputs = (msg.value)
# logger.info(inputs)
# if inputs is not None and len(inputs) is not 0:
# if inputs['url_end_point'] == 'translation_en':
# logger.info("Running kafka on {}".format(inputs['url_end_point']))
# logger.info("Running kafka-translation on {}".format(inputs['message']))
# out = translate_util.from_en(inputs['message'], translation_server)
# elif inputs['url_end_point'] == 'translation_hi':
# logger.info("Running kafka on {}".format(inputs['url_end_point']))
# logger.info("Running kafka-translation on {}".format(inputs['message']))
# out = translate_util.from_hindi(inputs['message'], translation_server)
# logger.info("final output kafka-translation_hi:{}".format(out))
# elif inputs['url_end_point'] == "translate-anuvaad":
# logger.info("Running kafka on {}".format(inputs['url_end_point']))
# logger.info("Running kafka-translation on {}".format(inputs['message']))
# out = translate_util.translate_func(inputs['message'], translation_server)
# logger.info("final output kafka-translate-anuvaad:{}".format(out))
# else:
# logger.info("Incorrect url_end_point for KAFKA")
# out['status'] = statusCode["KAFKA_INVALID_REQUEST"]
# out['response_body'] = []
# p.send(producer_topic, value={'out':out})
# p.flush()
# msg_sent += 1
# logger.info("*******************msg sent count*********:{}".format(msg_sent))
# except Exception as e:
# logger.error("Error in kafka_document_translator:nmt_translation: %s"% sys.exc_info()[0])
# logger.error("Error in kafka_document_translator:nmt_translation: {}".format(e))
# raise
\ No newline at end of file
This diff is collapsed.
Click to expand it.
translation_util/README_UTILS.md
0 → 100644
+
13
−
0
View file @
3e3bd411
Interactive Translation
Steps involved:
1.
Convert the trained model .pt file into binary file along with source and target vocabulary
The "interactive-model-convert" api expects following input:
1.
inp_model_path - path of model(.pt) file which needs to be converted
2.
out_dir - output path where binary model file and vocabulary are saved
2.
The converted model has to be updated in available_models/interactive_models/iconf.json file along with model id and the path where it
is saved(i.e out_dir)
3.
Make corresponding model changes in interactive_translation function and deploy
4.
The interactive apis can be accessed by running interactive_server.py
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets