Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -46,6 +46,7 @@ def get_predictions(text, mode):
|
|
46 |
num_beam_groups=3,
|
47 |
min_length=10,
|
48 |
max_length=100,
|
|
|
49 |
)
|
50 |
elif mode == "Polish - RfC Detection":
|
51 |
output = model_det_pl.generate(
|
@@ -70,8 +71,14 @@ if __name__ == "__main__":
|
|
70 |
st.sidebar.image(img_short)
|
71 |
st.image(img_full)
|
72 |
st.title("VLT5 - Reason for Contact generator")
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
user_input = st.text_area(
|
76 |
label=f"Input text (max {max_length} characters)",
|
77 |
value="",
|
@@ -90,19 +97,12 @@ if __name__ == "__main__":
|
|
90 |
)
|
91 |
|
92 |
result = st.button("Find reason for contact")
|
93 |
-
|
94 |
-
st.markdown("### You selected RfC Generation model.")
|
95 |
-
st.markdown("-- *Input*: Whole conversation. Should specify roles (e.g. **AGENT: Hello, how can I help you? CLIENT: Hi, I would like to report a stolen card.**")
|
96 |
-
st.markdown("-- *Output*: Reason for calling for the whole conversation.")
|
97 |
-
text_area = "Put a whole conversation or full e-mail here."
|
98 |
-
|
99 |
-
elif mode == "Polish - RfC Detection (accepts one turn)":
|
100 |
-
st.markdown("### You selected RfC Detection model.")
|
101 |
-
st.markdown("-- *Input*: A single turn from the conversation e.g. **'Hello, how can I help you?'** or **'Hi, I would like to report a stolen card.'**")
|
102 |
-
st.markdown("-- *Output*: Model will return an empty string if a turn possibly does not includes Reason for Calling, or a sentence if the RfC is detected.")
|
103 |
-
text_area = "Put a single turn or a few sentences here."
|
104 |
-
|
105 |
if result:
|
|
|
|
|
|
|
|
|
106 |
generated_rfc = get_predictions(text=user_input, mode=mode)
|
107 |
st.text_area(text_area, generated_rfc)
|
108 |
print(f"Input: {user_input} ---> Reason for contact: {generated_rfc}")
|
|
|
46 |
num_beam_groups=3,
|
47 |
min_length=10,
|
48 |
max_length=100,
|
49 |
+
diversity_penalty=1.0,
|
50 |
)
|
51 |
elif mode == "Polish - RfC Detection":
|
52 |
output = model_det_pl.generate(
|
|
|
71 |
st.sidebar.image(img_short)
|
72 |
st.image(img_full)
|
73 |
st.title("VLT5 - Reason for Contact generator")
|
74 |
+
st.markdown("### RfC Generation model.")
|
75 |
+
st.markdown("-- *Input*: Whole conversation. Should specify roles (e.g. **AGENT: Hello, how can I help you? CLIENT: Hi, I would like to report a stolen card.**")
|
76 |
+
st.markdown("-- *Output*: Reason for calling for the whole conversation.")
|
77 |
+
st.markdown("### RfC Detection model.")
|
78 |
+
st.markdown("-- *Input*: A single turn from the conversation e.g. **'Hello, how can I help you?'** or **'Hi, I would like to report a stolen card.'**")
|
79 |
+
st.markdown("-- *Output*: Model will return an empty string if a turn possibly does not includes Reason for Calling, or a sentence if the RfC is detected.")
|
80 |
+
|
81 |
+
generated_rfc = ""
|
82 |
user_input = st.text_area(
|
83 |
label=f"Input text (max {max_length} characters)",
|
84 |
value="",
|
|
|
97 |
)
|
98 |
|
99 |
result = st.button("Find reason for contact")
|
100 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
if result:
|
102 |
+
if mode == "Polish - RfC Generation (accepts whole conversation)":
|
103 |
+
text_area = "Put a whole conversation or full e-mail here."
|
104 |
+
elif mode == "Polish - RfC Detection (accepts one turn)":
|
105 |
+
text_area = "Put a single turn or a few sentences here."
|
106 |
generated_rfc = get_predictions(text=user_input, mode=mode)
|
107 |
st.text_area(text_area, generated_rfc)
|
108 |
print(f"Input: {user_input} ---> Reason for contact: {generated_rfc}")
|