Spaces:
Runtime error
Runtime error
Commit
·
333a86e
1
Parent(s):
df79f0c
Update main.py
Browse files
main.py
CHANGED
|
@@ -37,10 +37,15 @@ llm = HuggingFaceHub(repo_id=repo_id,
|
|
| 37 |
"top_p":0.95, "eos_token_id":49155})
|
| 38 |
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
prompt_template = """
|
| 41 |
-
<<SYS>>You are a helpful, respectful and honest assistant.
|
| 42 |
-
If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
|
| 43 |
-
In each conversation, question is placed after [INST] while your answer should be placed after [/INST].<</SYS>>
|
| 44 |
[INST] {user_question} [/INST]
|
| 45 |
assistant:
|
| 46 |
"""
|
|
@@ -54,7 +59,7 @@ def home_api():
|
|
| 54 |
data = request.get_json()
|
| 55 |
user_query = data['user_question']
|
| 56 |
print(user_query)
|
| 57 |
-
return {"
|
| 58 |
|
| 59 |
@app.route('/api/chat', methods=['POST'])
|
| 60 |
def chat():
|
|
|
|
| 37 |
"top_p":0.95, "eos_token_id":49155})
|
| 38 |
|
| 39 |
|
| 40 |
+
#prompt_template = """
|
| 41 |
+
#<<SYS>>You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.
|
| 42 |
+
#If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
|
| 43 |
+
#In each conversation, question is placed after [INST] while your answer should be placed after [/INST].<</SYS>>
|
| 44 |
+
#[INST] {user_question} [/INST]
|
| 45 |
+
#assistant:
|
| 46 |
+
#"""
|
| 47 |
prompt_template = """
|
| 48 |
+
<<SYS>>You are a helpful, respectful and honest assistant. If you don't know the answer to a question, please don't share false information.In each conversation, question is placed after [INST] while your answer should be placed after [/INST].<</SYS>>
|
|
|
|
|
|
|
| 49 |
[INST] {user_question} [/INST]
|
| 50 |
assistant:
|
| 51 |
"""
|
|
|
|
| 59 |
data = request.get_json()
|
| 60 |
user_query = data['user_question']
|
| 61 |
print(user_query)
|
| 62 |
+
return {"Message":"Flask Home API Deploy Success on HF"}
|
| 63 |
|
| 64 |
@app.route('/api/chat', methods=['POST'])
|
| 65 |
def chat():
|