Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -47,7 +47,8 @@ terminators = [
|
|
| 47 |
@spaces.GPU()
|
| 48 |
def stream_chat(
|
| 49 |
message: str,
|
| 50 |
-
history: list,
|
|
|
|
| 51 |
temperature: float = 0.8,
|
| 52 |
max_new_tokens: int = 1024,
|
| 53 |
top_p: float = 1.0,
|
|
@@ -57,7 +58,9 @@ def stream_chat(
|
|
| 57 |
print(f'message: {message}')
|
| 58 |
print(f'history: {history}')
|
| 59 |
|
| 60 |
-
conversation = [
|
|
|
|
|
|
|
| 61 |
for prompt, answer in history:
|
| 62 |
conversation.extend([
|
| 63 |
{"role": "user", "content": prompt},
|
|
@@ -102,6 +105,11 @@ with gr.Blocks(css=CSS, theme="soft") as demo:
|
|
| 102 |
fill_height=True,
|
| 103 |
additional_inputs_accordion=gr.Accordion(label="βοΈ Parameters", open=False, render=False),
|
| 104 |
additional_inputs=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
gr.Slider(
|
| 106 |
minimum=0,
|
| 107 |
maximum=1,
|
|
|
|
| 47 |
@spaces.GPU()
|
| 48 |
def stream_chat(
|
| 49 |
message: str,
|
| 50 |
+
history: list,
|
| 51 |
+
system_prompt: str,
|
| 52 |
temperature: float = 0.8,
|
| 53 |
max_new_tokens: int = 1024,
|
| 54 |
top_p: float = 1.0,
|
|
|
|
| 58 |
print(f'message: {message}')
|
| 59 |
print(f'history: {history}')
|
| 60 |
|
| 61 |
+
conversation = [
|
| 62 |
+
{"role": "system", "content": system_prompt}
|
| 63 |
+
]
|
| 64 |
for prompt, answer in history:
|
| 65 |
conversation.extend([
|
| 66 |
{"role": "user", "content": prompt},
|
|
|
|
| 105 |
fill_height=True,
|
| 106 |
additional_inputs_accordion=gr.Accordion(label="βοΈ Parameters", open=False, render=False),
|
| 107 |
additional_inputs=[
|
| 108 |
+
gr.Textbox(
|
| 109 |
+
value="You are a helpful assistant",
|
| 110 |
+
label="System Prompt",
|
| 111 |
+
render=False,
|
| 112 |
+
),
|
| 113 |
gr.Slider(
|
| 114 |
minimum=0,
|
| 115 |
maximum=1,
|