Spaces:
Sleeping
Sleeping
Alexandre Gazola
commited on
Commit
·
10d8b36
1
Parent(s):
82fbfc6
test
Browse files
app.py
CHANGED
@@ -141,13 +141,15 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
141 |
continue
|
142 |
question_text_for_agent = question_text
|
143 |
if file_name:
|
144 |
-
print(f"The following question has attatched file: {question_text[:
|
145 |
-
|
146 |
if file_name.endswith(('.mp3', '.xlsx', '.png')):
|
147 |
-
|
|
|
148 |
question_text_for_agent += f'. The content in base64 of the attatched file mentioned in the question is the following: {base64_attatched_file}'
|
149 |
else:
|
150 |
-
|
|
|
151 |
question_text_for_agent += f'. The attatchement has the following content: {plain_txt_file}'
|
152 |
question_text_for_agent += f'. The content in base64 of the attatched file mentioned in the question is the following: {base64_attatched_file}'
|
153 |
submitted_answer = agent(question_text_for_agent)
|
|
|
141 |
continue
|
142 |
question_text_for_agent = question_text
|
143 |
if file_name:
|
144 |
+
print(f"The following question has attatched file: {question_text[:50]}")
|
145 |
+
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
146 |
if file_name.endswith(('.mp3', '.xlsx', '.png')):
|
147 |
+
file_path = os.path.join(BASE_DIR, 'files', f'{file_name}.b64')
|
148 |
+
base64_attatched_file = get_text_file_contents(file_path)
|
149 |
question_text_for_agent += f'. The content in base64 of the attatched file mentioned in the question is the following: {base64_attatched_file}'
|
150 |
else:
|
151 |
+
file_path = os.path.join(BASE_DIR, 'files', file_name)
|
152 |
+
plain_txt_file = get_text_file_contents(file_path)
|
153 |
question_text_for_agent += f'. The attatchement has the following content: {plain_txt_file}'
|
154 |
question_text_for_agent += f'. The content in base64 of the attatched file mentioned in the question is the following: {base64_attatched_file}'
|
155 |
submitted_answer = agent(question_text_for_agent)
|