Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,14 +24,14 @@ def generate_response(input_text):
|
|
| 24 |
|
| 25 |
response_with_prefix = tokenizer.decode(output_sequences[:, input_ids.shape[-1]:][0], skip_special_tokens=True)
|
| 26 |
response_start_idx = response_with_prefix.find("answer: ")
|
| 27 |
-
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
|
| 32 |
-
|
| 33 |
|
| 34 |
-
|
| 35 |
|
| 36 |
prompt = st.chat_input(placeholder="Say Something!",key=None, max_chars=None, disabled=False, on_submit=None, args=None, kwargs=None)
|
| 37 |
if prompt:
|
|
|
|
| 24 |
|
| 25 |
response_with_prefix = tokenizer.decode(output_sequences[:, input_ids.shape[-1]:][0], skip_special_tokens=True)
|
| 26 |
response_start_idx = response_with_prefix.find("answer: ")
|
| 27 |
+
if response_start_idx != -1:
|
| 28 |
|
| 29 |
+
response = response_with_prefix[response_start_idx + len("answer: "):]
|
| 30 |
+
else:
|
| 31 |
|
| 32 |
+
response = response_with_prefix
|
| 33 |
|
| 34 |
+
return response
|
| 35 |
|
| 36 |
prompt = st.chat_input(placeholder="Say Something!",key=None, max_chars=None, disabled=False, on_submit=None, args=None, kwargs=None)
|
| 37 |
if prompt:
|