Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -44,7 +44,10 @@ default_value_tr = "How are you?"
|
|
44 |
tr_input = st.text_area(label = "Input in English", value = default_value_tr, height = 5)
|
45 |
tr = query(tr_input, model_id, api_token)
|
46 |
st.write("Translated Example:")
|
47 |
-
|
|
|
|
|
|
|
48 |
st.write("You can check out this [link](https://huggingface.co/models?pipeline_tag=translation&sort=downloads&search=helsinki-nlp) for available translation models.")
|
49 |
|
50 |
|
@@ -59,7 +62,10 @@ context = st.text_area(label = "Context", value = "π€ Transformers provides th
|
|
59 |
data = {"inputs": {"question": question, "context": context}}
|
60 |
output_answer = query(payload = data, model_id = model_id_q, api_token = api_token)
|
61 |
st.write("Answer:")
|
62 |
-
|
|
|
|
|
|
|
63 |
|
64 |
st.subheader("Add Characters to Your Conversational Agent π§π»π¦Ήπ»")
|
65 |
st.write("When trained, language models like GPT-2 or DialoGPT is capable of talking like any character you want. If you have a friend-like chatbot (instead of a chatbot built for RPA) you can give your users options to talk to their favorite character. There are couple of ways of doing this, you can either fine-tune DialoGPT with sequences of conversation turns, maybe movie dialogues, or infer with a large model like GPT-J. Note that these models might have biases and you will not have any control over output, unless you make an additional effort to filter it.")
|
|
|
44 |
tr_input = st.text_area(label = "Input in English", value = default_value_tr, height = 5)
|
45 |
tr = query(tr_input, model_id, api_token)
|
46 |
st.write("Translated Example:")
|
47 |
+
try:
|
48 |
+
st.write(tr[0]["translation_text"])
|
49 |
+
except:
|
50 |
+
st.write("Inference API loads model on demand, please wait for 10 secs and try again π€ ")
|
51 |
st.write("You can check out this [link](https://huggingface.co/models?pipeline_tag=translation&sort=downloads&search=helsinki-nlp) for available translation models.")
|
52 |
|
53 |
|
|
|
62 |
data = {"inputs": {"question": question, "context": context}}
|
63 |
output_answer = query(payload = data, model_id = model_id_q, api_token = api_token)
|
64 |
st.write("Answer:")
|
65 |
+
try:
|
66 |
+
st.write(output_answer["answer"])
|
67 |
+
except:
|
68 |
+
st.write("Inference API loads model on demand, please wait for 10 secs and try again π€ ")
|
69 |
|
70 |
st.subheader("Add Characters to Your Conversational Agent π§π»π¦Ήπ»")
|
71 |
st.write("When trained, language models like GPT-2 or DialoGPT is capable of talking like any character you want. If you have a friend-like chatbot (instead of a chatbot built for RPA) you can give your users options to talk to their favorite character. There are couple of ways of doing this, you can either fine-tune DialoGPT with sequences of conversation turns, maybe movie dialogues, or infer with a large model like GPT-J. Note that these models might have biases and you will not have any control over output, unless you make an additional effort to filter it.")
|