botsi commited on
Commit
e0cf4e2
·
verified ·
1 Parent(s): 4715a79

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -76,15 +76,15 @@ def generate(
76
 
77
  # Assuming params = request.query_params is the dictionary containing the query parameters
78
  # Extract the value of the 'session_index' parameter
79
- session_index_value = params.get('session_index')
80
 
81
  # Check if session_index_value is None or contains a value
82
- if session_index_value is not None:
83
- print("Session index:", session_index_value)
84
  else:
85
  print("Session index parameter not found or has no value.")
86
 
87
- def fetch_personalized_data(session_index_value):
88
  try:
89
  # Connect to the database
90
  with mysql.connector.connect(
@@ -121,7 +121,7 @@ def generate(
121
  FROM e5390g37096_core
122
  JOIN e5390g37096_decisions ON
123
  e5390g37096_core.playerNr = e5390g37096_decisions.playerNr
124
- WHERE e5390g37096_decisions.session_index = %s
125
  UNION ALL
126
  SELECT e5390g37096_core.playerNr,
127
  e5390g37096_core.groupNrStart,
@@ -152,8 +152,8 @@ def generate(
152
  FROM e5390g37096_core
153
  JOIN e5390g37096_decisions
154
  ON e5390g37096_core.playerNr = e5390g37096_decisions.playerNr
155
- WHERE e5390g37096_decisions.session_index = %s
156
- ) AND e5390g37096_decisions.session_index != %s
157
  """
158
  cursor.execute(query, (session_index, session_index, session_index))
159
  # Fetch data row by row
@@ -186,7 +186,7 @@ def generate(
186
  print(f"Error: {err}")
187
  return None
188
 
189
- personalized_data = fetch_personalized_data(session_index_value)
190
 
191
  ## trust-game-llama-2-7b-chat
192
  # app.py
 
76
 
77
  # Assuming params = request.query_params is the dictionary containing the query parameters
78
  # Extract the value of the 'session_index' parameter
79
+ session_index = params.get('session_index')
80
 
81
  # Check if session_index_value is None or contains a value
82
+ if session_index is not None:
83
+ print("Session index:", session_index)
84
  else:
85
  print("Session index parameter not found or has no value.")
86
 
87
+ def fetch_personalized_data(session_index):
88
  try:
89
  # Connect to the database
90
  with mysql.connector.connect(
 
121
  FROM e5390g37096_core
122
  JOIN e5390g37096_decisions ON
123
  e5390g37096_core.playerNr = e5390g37096_decisions.playerNr
124
+ WHERE e5390g37096_decisions.session_index = {session_index}
125
  UNION ALL
126
  SELECT e5390g37096_core.playerNr,
127
  e5390g37096_core.groupNrStart,
 
152
  FROM e5390g37096_core
153
  JOIN e5390g37096_decisions
154
  ON e5390g37096_core.playerNr = e5390g37096_decisions.playerNr
155
+ WHERE e5390g37096_decisions.session_index = {session_index}
156
+ ) AND e5390g37096_decisions.session_index != {session_index}
157
  """
158
  cursor.execute(query, (session_index, session_index, session_index))
159
  # Fetch data row by row
 
186
  print(f"Error: {err}")
187
  return None
188
 
189
+ personalized_data = fetch_personalized_data(session_index)
190
 
191
  ## trust-game-llama-2-7b-chat
192
  # app.py