Update app.py
Browse files
app.py
CHANGED
|
@@ -95,10 +95,10 @@ def respond(
|
|
| 95 |
#print("# Case number: " + doc.metadata["case_nb"] + spacer)
|
| 96 |
#print("# Case url: " + doc.metadata["case_url"] + spacer)
|
| 97 |
|
| 98 |
-
system_message
|
| 99 |
A user is asking you a question in his own language.
|
| 100 |
If the question is not related to legal matters and does not require any context, just answer the user in his own language without using the provided context.
|
| 101 |
-
|
| 102 |
# Context:
|
| 103 |
The following case extracts have been found in either Swiss Federal Court or European Court of Human Rights cases and could fit the question:
|
| 104 |
{context}
|
|
@@ -142,7 +142,7 @@ For information on how to customize the ChatInterface, peruse the gradio docs: h
|
|
| 142 |
demo = gr.ChatInterface(
|
| 143 |
respond,
|
| 144 |
additional_inputs=[
|
| 145 |
-
gr.Textbox(value="You are
|
| 146 |
gr.Slider(minimum=1, maximum=24000, value=5000, step=1, label="Max new tokens"),
|
| 147 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.1, step=0.1, label="Temperature"),
|
| 148 |
gr.Slider(
|
|
|
|
| 95 |
#print("# Case number: " + doc.metadata["case_nb"] + spacer)
|
| 96 |
#print("# Case url: " + doc.metadata["case_url"] + spacer)
|
| 97 |
|
| 98 |
+
system_message += f"""
|
| 99 |
A user is asking you a question in his own language.
|
| 100 |
If the question is not related to legal matters and does not require any context, just answer the user in his own language without using the provided context.
|
| 101 |
+
Otherwise, please answer the user in the same language that he used in his question using ONLY the following given context not any prior knowledge or information found on the internet.
|
| 102 |
# Context:
|
| 103 |
The following case extracts have been found in either Swiss Federal Court or European Court of Human Rights cases and could fit the question:
|
| 104 |
{context}
|
|
|
|
| 142 |
demo = gr.ChatInterface(
|
| 143 |
respond,
|
| 144 |
additional_inputs=[
|
| 145 |
+
gr.Textbox(value="You are assisting a jurist or a layer in finding relevant Swiss Jurisprudence cases to their question.", label="System message"),
|
| 146 |
gr.Slider(minimum=1, maximum=24000, value=5000, step=1, label="Max new tokens"),
|
| 147 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.1, step=0.1, label="Temperature"),
|
| 148 |
gr.Slider(
|