Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -52,7 +52,7 @@ def process_inputs(user_input_json, session_id_json, project_id, chat_url, updat
|
|
| 52 |
unique_output.add(y)
|
| 53 |
|
| 54 |
dict_output = {
|
| 55 |
-
uni: [[]
|
| 56 |
}
|
| 57 |
|
| 58 |
# --- Your function logic here ---
|
|
@@ -87,11 +87,12 @@ def run_chat(chat_url, project_id, session_id, user_input, update_variables, out
|
|
| 87 |
|
| 88 |
print("[REQ CONTENT]", req.content)
|
| 89 |
|
| 90 |
-
out = req.json()["data"]
|
| 91 |
|
| 92 |
-
print("[OUT]",out)
|
| 93 |
|
| 94 |
-
return out
|
|
|
|
| 95 |
|
| 96 |
|
| 97 |
def run_process(df):
|
|
@@ -120,7 +121,15 @@ def run_process(df):
|
|
| 120 |
row["output_variables"],
|
| 121 |
row["token"]
|
| 122 |
)
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
csv_path = "output.csv"
|
| 125 |
df.to_csv(csv_path, index=False)
|
| 126 |
return csv_path, df
|
|
|
|
| 52 |
unique_output.add(y)
|
| 53 |
|
| 54 |
dict_output = {
|
| 55 |
+
uni: [[] for _ in user_input] for uni in unique_output
|
| 56 |
}
|
| 57 |
|
| 58 |
# --- Your function logic here ---
|
|
|
|
| 87 |
|
| 88 |
print("[REQ CONTENT]", req.content)
|
| 89 |
|
| 90 |
+
out = req.json()["data"]
|
| 91 |
|
| 92 |
+
print("[OUT]",out.get("results"))
|
| 93 |
|
| 94 |
+
return out
|
| 95 |
+
#return {out_var:out[out_var] for out_var in output_variables}
|
| 96 |
|
| 97 |
|
| 98 |
def run_process(df):
|
|
|
|
| 121 |
row["output_variables"],
|
| 122 |
row["token"]
|
| 123 |
)
|
| 124 |
+
|
| 125 |
+
if isinstance(answer, list):
|
| 126 |
+
for ans in answer:
|
| 127 |
+
for key,val in ans.items():
|
| 128 |
+
df.loc[index, key].append(val)
|
| 129 |
+
else:
|
| 130 |
+
for key,ans in answer.items():
|
| 131 |
+
df.loc[index, key] = ans
|
| 132 |
+
|
| 133 |
csv_path = "output.csv"
|
| 134 |
df.to_csv(csv_path, index=False)
|
| 135 |
return csv_path, df
|