Haseeb javed
commited on
Commit
·
3b34c62
1
Parent(s):
db445f0
10:30
Browse files
app.py
CHANGED
@@ -32,13 +32,15 @@ def generate_response(prompt):
|
|
32 |
)
|
33 |
token = outputs.sequences[0, input_length:]
|
34 |
full_response = tokenizer.decode(token, skip_special_tokens=True)
|
35 |
-
|
36 |
-
if "
|
37 |
-
|
38 |
-
response = "\n".join(line for line in response_lines if "<bot>:" not in line)
|
39 |
else:
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
42 |
|
43 |
@app.route("/", methods=["GET"])
|
44 |
def home():
|
|
|
32 |
)
|
33 |
token = outputs.sequences[0, input_length:]
|
34 |
full_response = tokenizer.decode(token, skip_special_tokens=True)
|
35 |
+
|
36 |
+
if "<human>" in full_response:
|
37 |
+
trimmed_response = full_response.split("<human>")[0].strip()
|
|
|
38 |
else:
|
39 |
+
trimmed_response = full_response.strip()
|
40 |
+
|
41 |
+
logging.debug(f"Trimmed response: {trimmed_response}")
|
42 |
+
return trimmed_response
|
43 |
+
|
44 |
|
45 |
@app.route("/", methods=["GET"])
|
46 |
def home():
|