Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -77,10 +77,7 @@ def run_gpt(
|
|
| 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)
|
|
@@ -150,6 +147,46 @@ def compress_data(c,purpose, task, history):
|
|
| 150 |
|
| 151 |
|
| 152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
def get_key(inp,data):
|
| 154 |
key_box=[]
|
| 155 |
seed=random.randint(1,1000000000)
|
|
@@ -380,7 +417,7 @@ with gr.Blocks() as app:
|
|
| 380 |
with gr.Row():
|
| 381 |
out_json = gr.JSON()
|
| 382 |
fil = gr.Textbox()
|
| 383 |
-
keyw.click(
|
| 384 |
load_btn.click(load_data,None,[out_json,cb])
|
| 385 |
u_btn.click(find_rss,None,[out_json,cb])
|
| 386 |
sub_btn.click(summarize,[inst,cb,out_json],[inst,cb])
|
|
|
|
| 77 |
purpose=purpose,
|
| 78 |
) + prompt_template.format(**prompt_kwargs)
|
| 79 |
if prefix_tog == "alternate":
|
| 80 |
+
content = PREFIX_ALT + prompt_template.format(**prompt_kwargs)
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
|
| 83 |
#formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
|
|
|
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
+
def get_records(inp,data):
|
| 151 |
+
key_box=[]
|
| 152 |
+
seed=random.randint(1,1000000000)
|
| 153 |
+
print (c)
|
| 154 |
+
divr=int(c)/MAX_DATA
|
| 155 |
+
divi=int(divr)+1 if divr != int(divr) else int(divr)
|
| 156 |
+
chunk = int(int(c)/divr)
|
| 157 |
+
print(f'chunk:: {chunk}')
|
| 158 |
+
print(f'divr:: {divr}')
|
| 159 |
+
print (f'divi:: {divi}')
|
| 160 |
+
out = []
|
| 161 |
+
s=0
|
| 162 |
+
e=chunk
|
| 163 |
+
print(f'e:: {e}')
|
| 164 |
+
new_history=""
|
| 165 |
+
#task = f'Compile this data to fulfill the task: {task}, and complete the purpose: {purpose}\n'
|
| 166 |
+
for z in range(divi):
|
| 167 |
+
print(f's:e :: {s}:{e}')
|
| 168 |
+
|
| 169 |
+
hist = data[s:e]
|
| 170 |
+
print(f'hist::\n{hist}')
|
| 171 |
+
resp = run_gpt(
|
| 172 |
+
GET_KEYWORD,
|
| 173 |
+
stop_tokens=[],
|
| 174 |
+
max_tokens=2048,
|
| 175 |
+
seed=seed,
|
| 176 |
+
purpose=inp,
|
| 177 |
+
prefix_tog="alternate",
|
| 178 |
+
task=inp,
|
| 179 |
+
knowledge=new_history,
|
| 180 |
+
history=hist,
|
| 181 |
+
).strip("\n")
|
| 182 |
+
new_history = resp
|
| 183 |
+
print (resp)
|
| 184 |
+
out+=resp
|
| 185 |
+
e=e+chunk
|
| 186 |
+
s=s+chunk
|
| 187 |
+
yield "", [(inp,new_history)]
|
| 188 |
+
|
| 189 |
+
|
| 190 |
def get_key(inp,data):
|
| 191 |
key_box=[]
|
| 192 |
seed=random.randint(1,1000000000)
|
|
|
|
| 417 |
with gr.Row():
|
| 418 |
out_json = gr.JSON()
|
| 419 |
fil = gr.Textbox()
|
| 420 |
+
keyw.click(get_records,[inst,out_json],[inst,cb])
|
| 421 |
load_btn.click(load_data,None,[out_json,cb])
|
| 422 |
u_btn.click(find_rss,None,[out_json,cb])
|
| 423 |
sub_btn.click(summarize,[inst,cb,out_json],[inst,cb])
|