laverdes commited on
Commit
65578ac
·
verified ·
1 Parent(s): 7fb2f57

dev: fix dev error

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -135,16 +135,19 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
135
  task_id = item.get("task_id")
136
  question_text = item.get("question")
137
  question_level = item.get("Level")
138
- question_file_name = item.get("file_name")
139
  print("\nquestion level: ", question_level)
140
  print("question file_name: ", question_file_name)
141
 
142
  found= False
 
143
  for root, dirs, files in os.walk("/"):
144
  if question_file_name in files:
145
- print("FILE FOUND AT:", os.path.join(root, "cca530fc-4052-43b2-b130-b30968d8aa44.png"))
 
 
146
  found=True
147
- if not found:
148
  print("FILE WAS NOT FOUND LOCALLY... try making an api request to .files/ or ./static in the hf.space target (or check it manually first)")
149
  import sys
150
  sys.exit()
@@ -154,10 +157,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
154
  continue
155
 
156
  try:
157
- image_path = question_file_name if ".png" in question_file_name else ""
158
- metadata = {}
159
- if image_path:
160
- metadata = {'image_path': image_path}
161
  q_data = {'query': question_text, 'metadata': metadata}
162
  submitted_answer = agent(q_data) # todo: send more data (files)
163
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
 
135
  task_id = item.get("task_id")
136
  question_text = item.get("question")
137
  question_level = item.get("Level")
138
+ question_file_name = item.get("file_name", None)
139
  print("\nquestion level: ", question_level)
140
  print("question file_name: ", question_file_name)
141
 
142
  found= False
143
+ metadata = {}
144
  for root, dirs, files in os.walk("/"):
145
  if question_file_name in files:
146
+ file_path = os.path.join(root, question_file_name)
147
+ print("FILE FOUND AT:", file_path)
148
+ metadata = {'image_path': file_path} if '.png' in question_file_name else {}
149
  found=True
150
+ if question_file_name and not found:
151
  print("FILE WAS NOT FOUND LOCALLY... try making an api request to .files/ or ./static in the hf.space target (or check it manually first)")
152
  import sys
153
  sys.exit()
 
157
  continue
158
 
159
  try:
160
+
 
 
 
161
  q_data = {'query': question_text, 'metadata': metadata}
162
  submitted_answer = agent(q_data) # todo: send more data (files)
163
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})