Spaces:
Sleeping
Sleeping
Commit
·
1461675
1
Parent(s):
b41ff88
Refactor DataFrame creation in API response processing for clarity
Browse files
helper.py
CHANGED
|
@@ -12,11 +12,11 @@ def process_api_response(json_response):
|
|
| 12 |
similarity_attr = input_data.get("similarity_attr", {})
|
| 13 |
|
| 14 |
# Convert predictions into a DataFrame and back to a dictionary
|
| 15 |
-
temp_predictions_df = pd.DataFrame(predictions)
|
| 16 |
temp_predictions_dict = temp_predictions_df.to_dict()
|
| 17 |
|
| 18 |
# Convert similarity attributes into a DataFrame and back to a dictionary
|
| 19 |
-
sim_attr_df = pd.DataFrame(similarity_attr)
|
| 20 |
sample_sim_attr = sim_attr_df.to_dict()
|
| 21 |
|
| 22 |
# Construct final output dictionary
|
|
|
|
| 12 |
similarity_attr = input_data.get("similarity_attr", {})
|
| 13 |
|
| 14 |
# Convert predictions into a DataFrame and back to a dictionary
|
| 15 |
+
temp_predictions_df = pd.DataFrame(predictions)
|
| 16 |
temp_predictions_dict = temp_predictions_df.to_dict()
|
| 17 |
|
| 18 |
# Convert similarity attributes into a DataFrame and back to a dictionary
|
| 19 |
+
sim_attr_df = pd.DataFrame(similarity_attr)
|
| 20 |
sample_sim_attr = sim_attr_df.to_dict()
|
| 21 |
|
| 22 |
# Construct final output dictionary
|