Update app.py
Browse files
app.py
CHANGED
@@ -48,7 +48,7 @@ import torch
|
|
48 |
B_INST, E_INST = "[INST]", "[/INST]"
|
49 |
B_SYS, E_SYS = "<>\n", "\n<>\n\n"
|
50 |
DEFAULT_SYSTEM_PROMPT = """\
|
51 |
-
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.
|
52 |
|
53 |
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.Just say you don't know and you are sorry!"""
|
54 |
|
@@ -97,7 +97,7 @@ def parse_text(text):
|
|
97 |
from langchain import HuggingFacePipeline
|
98 |
from langchain import PromptTemplate, LLMChain
|
99 |
|
100 |
-
llm = HuggingFacePipeline(pipeline = pipe, model_kwargs = {'temperature':0})
|
101 |
|
102 |
|
103 |
system_prompt = "You are an advanced legal assistant that excels at giving advice. "
|
@@ -114,7 +114,7 @@ text = st.text_input('Plug in your prompt here')
|
|
114 |
|
115 |
if text:
|
116 |
response = llm_chain.run(text)
|
117 |
-
st.write(
|
118 |
|
119 |
|
120 |
|
|
|
48 |
B_INST, E_INST = "[INST]", "[/INST]"
|
49 |
B_SYS, E_SYS = "<>\n", "\n<>\n\n"
|
50 |
DEFAULT_SYSTEM_PROMPT = """\
|
51 |
+
You are a helpful, respectful and honest legal assistant who will answer legal questions a user would ask with step-by-step explanation and advice. 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.
|
52 |
|
53 |
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.Just say you don't know and you are sorry!"""
|
54 |
|
|
|
97 |
from langchain import HuggingFacePipeline
|
98 |
from langchain import PromptTemplate, LLMChain
|
99 |
|
100 |
+
llm = HuggingFacePipeline(pipeline = pipe, model_kwargs = {'temperature':0.7,'max_length': 256, 'top_k' :50})
|
101 |
|
102 |
|
103 |
system_prompt = "You are an advanced legal assistant that excels at giving advice. "
|
|
|
114 |
|
115 |
if text:
|
116 |
response = llm_chain.run(text)
|
117 |
+
st.write(response)
|
118 |
|
119 |
|
120 |
|