Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -61,6 +61,7 @@ def run_gpt(
|
|
61 |
stop_tokens,
|
62 |
max_tokens,
|
63 |
seed,
|
|
|
64 |
**prompt_kwargs,
|
65 |
):
|
66 |
print(seed)
|
@@ -77,7 +78,7 @@ def run_gpt(
|
|
77 |
|
78 |
content = PREFIX.format(
|
79 |
timestamp=timestamp,
|
80 |
-
purpose=
|
81 |
) + prompt_template.format(**prompt_kwargs)
|
82 |
if VERBOSE:
|
83 |
print(LOG_PROMPT.format(content))
|
@@ -96,7 +97,7 @@ def run_gpt(
|
|
96 |
print(LOG_RESPONSE.format(resp))
|
97 |
return resp
|
98 |
|
99 |
-
def compress_data(c, history):
|
100 |
seed=random.randint(1,1000000000)
|
101 |
|
102 |
print (c)
|
@@ -125,7 +126,7 @@ def compress_data(c, history):
|
|
125 |
stop_tokens=["observation:", "task:", "action:", "thought:"],
|
126 |
max_tokens=4096,
|
127 |
seed=seed,
|
128 |
-
purpose=
|
129 |
knowledge=new_history,
|
130 |
history=hist,
|
131 |
)
|
@@ -145,12 +146,13 @@ def compress_data(c, history):
|
|
145 |
history="All data has been recieved.",
|
146 |
)
|
147 |
print ("final" + resp)
|
148 |
-
history = "observation: {}\n".format(resp)
|
149 |
-
return
|
150 |
|
151 |
|
152 |
|
153 |
-
def summarize(inp,history,file=None):
|
|
|
154 |
history = [(inp,"Working on it...")] if not history else history
|
155 |
|
156 |
yield "",history
|
@@ -164,7 +166,7 @@ def summarize(inp,history,file=None):
|
|
164 |
print (e)
|
165 |
|
166 |
print(inp)
|
167 |
-
out = str(
|
168 |
rl = len(out)
|
169 |
print(f'rl:: {rl}')
|
170 |
c=0
|
@@ -173,7 +175,7 @@ def summarize(inp,history,file=None):
|
|
173 |
c +=1
|
174 |
print (f'c:: {c}')
|
175 |
|
176 |
-
rawp = compress_data(c,out)
|
177 |
|
178 |
#print (rawp)
|
179 |
#print (f'out:: {out}')
|
|
|
61 |
stop_tokens,
|
62 |
max_tokens,
|
63 |
seed,
|
64 |
+
purpose,
|
65 |
**prompt_kwargs,
|
66 |
):
|
67 |
print(seed)
|
|
|
78 |
|
79 |
content = PREFIX.format(
|
80 |
timestamp=timestamp,
|
81 |
+
purpose=purpose
|
82 |
) + prompt_template.format(**prompt_kwargs)
|
83 |
if VERBOSE:
|
84 |
print(LOG_PROMPT.format(content))
|
|
|
97 |
print(LOG_RESPONSE.format(resp))
|
98 |
return resp
|
99 |
|
100 |
+
def compress_data(c, instruct, history):
|
101 |
seed=random.randint(1,1000000000)
|
102 |
|
103 |
print (c)
|
|
|
126 |
stop_tokens=["observation:", "task:", "action:", "thought:"],
|
127 |
max_tokens=4096,
|
128 |
seed=seed,
|
129 |
+
purpose=instruct,
|
130 |
knowledge=new_history,
|
131 |
history=hist,
|
132 |
)
|
|
|
146 |
history="All data has been recieved.",
|
147 |
)
|
148 |
print ("final" + resp)
|
149 |
+
#history = "observation: {}\n".format(resp)
|
150 |
+
return resp
|
151 |
|
152 |
|
153 |
|
154 |
+
def summarize(inp,history,data=None,file=None):
|
155 |
+
#file = None
|
156 |
history = [(inp,"Working on it...")] if not history else history
|
157 |
|
158 |
yield "",history
|
|
|
166 |
print (e)
|
167 |
|
168 |
print(inp)
|
169 |
+
out = str(data)
|
170 |
rl = len(out)
|
171 |
print(f'rl:: {rl}')
|
172 |
c=0
|
|
|
175 |
c +=1
|
176 |
print (f'c:: {c}')
|
177 |
|
178 |
+
rawp = compress_data(c,inp,out)
|
179 |
|
180 |
#print (rawp)
|
181 |
#print (f'out:: {out}')
|