Update app.py
Browse files
app.py
CHANGED
@@ -155,24 +155,26 @@ def comment_generate(prompt, history,post_check,full_conv, agent_name=agents[0],
|
|
155 |
r = requests.get(f'{save_data}{post_check["filename"]}')
|
156 |
print(f'status code main:: {r.status_code}')
|
157 |
if r.status_code==200:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
upload_file(
|
170 |
-
path_or_fileobj =f"{uid}.json",
|
171 |
-
path_in_repo = f"book1/{post_check['filename']}",
|
172 |
-
repo_id =f"{username}/{dataset_name}",
|
173 |
-
repo_type = "dataset",
|
174 |
-
token=token,
|
175 |
-
)
|
176 |
return "",history,post_check,post_check,post_check,html_out
|
177 |
|
178 |
|
|
|
155 |
r = requests.get(f'{save_data}{post_check["filename"]}')
|
156 |
print(f'status code main:: {r.status_code}')
|
157 |
if r.status_code==200:
|
158 |
+
try:
|
159 |
+
lod = json.loads(r.text)
|
160 |
+
lod = lod['comment_list'].append({'user':list_of_users[1],'datetime':'','comment':output})
|
161 |
+
#hist_out.append(out_json)
|
162 |
+
#try:
|
163 |
+
# for ea in
|
164 |
+
with open(f'{uid}.json', 'w') as f:
|
165 |
+
json_hist=json.dumps(lod, indent=4)
|
166 |
+
f.write(json_hist)
|
167 |
+
f.close()
|
168 |
|
169 |
+
upload_file(
|
170 |
+
path_or_fileobj =f"{uid}.json",
|
171 |
+
path_in_repo = f"book1/{post_check['filename']}",
|
172 |
+
repo_id =f"{username}/{dataset_name}",
|
173 |
+
repo_type = "dataset",
|
174 |
+
token=token,
|
175 |
+
)
|
176 |
+
except Exception as e:
|
177 |
+
print(e)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
return "",history,post_check,post_check,post_check,html_out
|
179 |
|
180 |
|