Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -14,6 +14,7 @@ from prompts import (
|
|
14 |
COMPRESS_HISTORY_PROMPT,
|
15 |
COMPRESS_DATA_PROMPT,
|
16 |
COMPRESS_DATA_PROMPT_SMALL,
|
|
|
17 |
PREFIX,
|
18 |
)
|
19 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
@@ -56,6 +57,7 @@ def run_gpt(
|
|
56 |
max_tokens,
|
57 |
seed,
|
58 |
purpose,
|
|
|
59 |
**prompt_kwargs,
|
60 |
):
|
61 |
timestamp=datetime.datetime.now()
|
@@ -69,12 +71,17 @@ def run_gpt(
|
|
69 |
do_sample=True,
|
70 |
seed=seed,
|
71 |
)
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
#formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
|
80 |
#formatted_prompt = format_prompt(f'{content}', **prompt_kwargs['history'])
|
@@ -115,6 +122,7 @@ def compress_data(c,purpose, task, history):
|
|
115 |
max_tokens=2048,
|
116 |
seed=seed,
|
117 |
purpose=purpose,
|
|
|
118 |
task=task,
|
119 |
knowledge=new_history,
|
120 |
history=hist,
|
@@ -151,6 +159,7 @@ def get_key(inp,data):
|
|
151 |
max_tokens=56,
|
152 |
seed=seed,
|
153 |
purpose=inp,
|
|
|
154 |
task=inp,
|
155 |
).split("<")[0]
|
156 |
print(f'key_w::{key_w}')
|
@@ -227,6 +236,7 @@ def summarize(inp,history,data=None):
|
|
227 |
max_tokens=2048,
|
228 |
seed=seed,
|
229 |
purpose=purpose,
|
|
|
230 |
task=task,
|
231 |
knowledge=new_history,
|
232 |
history=hist,
|
@@ -356,7 +366,7 @@ def load_data():
|
|
356 |
filename_end = filename_end.replace("-"[0],":").replace("-"[0],":").replace("-"[0],".")
|
357 |
#filename_end_far=filename_end.split(":")[2]
|
358 |
print (filename)
|
359 |
-
|
360 |
|
361 |
with gr.Blocks() as app:
|
362 |
cb = gr.Chatbot(height=600, show_share_button=True, show_copy_button=True)
|
|
|
14 |
COMPRESS_HISTORY_PROMPT,
|
15 |
COMPRESS_DATA_PROMPT,
|
16 |
COMPRESS_DATA_PROMPT_SMALL,
|
17 |
+
PREFIX_ALT,
|
18 |
PREFIX,
|
19 |
)
|
20 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
|
|
57 |
max_tokens,
|
58 |
seed,
|
59 |
purpose,
|
60 |
+
prefix_tog,
|
61 |
**prompt_kwargs,
|
62 |
):
|
63 |
timestamp=datetime.datetime.now()
|
|
|
71 |
do_sample=True,
|
72 |
seed=seed,
|
73 |
)
|
74 |
+
if prefix_tog == "normal":
|
75 |
+
content = PREFIX.format(
|
76 |
+
timestamp=timestamp,
|
77 |
+
purpose=purpose,
|
78 |
+
) + prompt_template.format(**prompt_kwargs)
|
79 |
+
if prefix_tog == "alternate":
|
80 |
+
content = PREFIX_ALT.format(
|
81 |
+
timestamp=timestamp,
|
82 |
+
purpose=purpose,
|
83 |
+
) + prompt_template.format(**prompt_kwargs)
|
84 |
+
|
85 |
|
86 |
#formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
|
87 |
#formatted_prompt = format_prompt(f'{content}', **prompt_kwargs['history'])
|
|
|
122 |
max_tokens=2048,
|
123 |
seed=seed,
|
124 |
purpose=purpose,
|
125 |
+
prefix_tog="normal",
|
126 |
task=task,
|
127 |
knowledge=new_history,
|
128 |
history=hist,
|
|
|
159 |
max_tokens=56,
|
160 |
seed=seed,
|
161 |
purpose=inp,
|
162 |
+
prefix_tog="normal",
|
163 |
task=inp,
|
164 |
).split("<")[0]
|
165 |
print(f'key_w::{key_w}')
|
|
|
236 |
max_tokens=2048,
|
237 |
seed=seed,
|
238 |
purpose=purpose,
|
239 |
+
prefix_tog="normal",
|
240 |
task=task,
|
241 |
knowledge=new_history,
|
242 |
history=hist,
|
|
|
366 |
filename_end = filename_end.replace("-"[0],":").replace("-"[0],":").replace("-"[0],".")
|
367 |
#filename_end_far=filename_end.split(":")[2]
|
368 |
print (filename)
|
369 |
+
return lod,[(None,f'Source is current as of:\n{filename_start} {filename_end} UTC\n\nThe current Date and Time is:\n{timestamp} UTC')]
|
370 |
|
371 |
with gr.Blocks() as app:
|
372 |
cb = gr.Chatbot(height=600, show_share_button=True, show_copy_button=True)
|