Update app.py
Browse files
app.py
CHANGED
@@ -129,8 +129,12 @@ def hermes_generate_response(msg_prompt: str) -> dict:
|
|
129 |
'''
|
130 |
pipe_output = pipe(prompt_template)[0]['generated_text']
|
131 |
#assistant_reply = pipe_output.split('\n\n')[1]
|
|
|
|
|
|
|
132 |
|
133 |
-
|
|
|
134 |
except Exception as e:
|
135 |
return {"error": str(e)}
|
136 |
|
|
|
129 |
'''
|
130 |
pipe_output = pipe(prompt_template)[0]['generated_text']
|
131 |
#assistant_reply = pipe_output.split('\n\n')[1]
|
132 |
+
# Separate user's prompt and assistant's response
|
133 |
+
response_lines = pipe_output.split('\n\n')
|
134 |
+
assistant_response = response_lines[-1].strip() # Get the last line
|
135 |
|
136 |
+
|
137 |
+
return {"user": msg_prompt, "assistant": assistant_response}
|
138 |
except Exception as e:
|
139 |
return {"error": str(e)}
|
140 |
|