merve HF staff commited on
Commit
5adb4c6
1 Parent(s): 1b039c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -17,4 +17,18 @@ st.write("Paraphrased Example:")
17
  st.write(outputs[0]["generated_text"])
18
 
19
  st.subheader("Add Personas to Your Conversational Agent using GPT-2")
20
- st.subheader("Multilingual Models using Translation Models")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  st.write(outputs[0]["generated_text"])
18
 
19
  st.subheader("Add Personas to Your Conversational Agent using GPT-2")
20
+
21
+
22
+
23
+ st.subheader("Multilingual Models using Translation Models")
24
+ st.write("Scaling your chatbot across different languages is expensive and cumbersome. There are couple of ways on how to make your chatbot speak a different language. You can either translate the intent classification data and responses and train another model and deploy it,, or you can put translation models at two ends. There are advantages and disadvantages in both approaches. For the first one, you can assess the performance of the model and hand your responses to a native speaker to have more control over what your bot says, but it requires more resources compared to second one. For the second one, assume that you're making a chatbot that is in English and want to have another language, say, German. You need two models, from German to English and from English to German.")
25
+ st.image("./chatbot.png")
26
+ st.write("Your English intent classification model will be between these two models, your German to English model will translate the input to English and the output will go through the intent classification model, which will classify intent and select appropriate response (which is currently in English). The response will be translated back to German, which you can do in advance and do proofreading with a native speaker or directly pass it to a from English to German language model. For this use case, I highly recommend specific translation models instead of using sequence-to-sequence multilingual models like T5. ")
27
+
28
+ model_checkpoint = "Helsinki-NLP/opus-mt-en-fr"
29
+ translator = pipeline("translation", model=model_checkpoint)
30
+ sent = st.text_area("Input", default_value, height = 10)
31
+ outputs = translator(sent)
32
+ st.write("Translated Example:")
33
+ translated_text = translator("How are you?")
34
+ st.write(outputs[0]["translation_text"])