qq1023 commited on
Commit
dd357d8
1 Parent(s): fa465f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -8
app.py CHANGED
@@ -213,14 +213,26 @@ def process_and_output_files(input_files):
213
  #parsed_info = parse(category, chatbot_response)
214
  chats=list(chatbot_response)
215
  # Append the relevant data for this file to the output_data list
216
- data.append(
217
- #"File Name": file.name,
218
- #"Extracted Text": text,
219
- #"Category": category,
220
- #"Chatbot Response": chatbot_response, # Access the first element as a list
221
- #"trial" : chats,
222
- chats[1]["value"][0][1] ,
223
- )
 
 
 
 
 
 
 
 
 
 
 
 
224
 
225
  #data_dicts = [json.loads(item[0]) for item in data]
226
 
 
213
  #parsed_info = parse(category, chatbot_response)
214
  chats=list(chatbot_response)
215
  # Append the relevant data for this file to the output_data list
216
+ # data.append(
217
+ # #"File Name": file.name,
218
+ # #"Extracted Text": text,
219
+ # #"Category": category,
220
+ # #"Chatbot Response": chatbot_response, # Access the first element as a list
221
+ # #"trial" : chats,
222
+ # chats[1]["value"][0][1] ,
223
+ # )
224
+
225
+ response_dict = json.loads(chats[1]["value"][0][1])
226
+
227
+ # Extract the relevant data
228
+ extracted_data = {
229
+ "Category": category,
230
+ "UIDs": response_dict.get("uids"),
231
+ "Total": response_dict.get("total")
232
+ }
233
+
234
+ # Append the relevant data for this file to the data list
235
+ data.append(extracted_data)
236
 
237
  #data_dicts = [json.loads(item[0]) for item in data]
238