GattoNero commited on
Commit
01bccaf
·
verified ·
1 Parent(s): c3ae3ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -23
app.py CHANGED
@@ -90,7 +90,7 @@ class BasicAgent:
90
  print_coso(f"__call__ file_info: {file_info}")
91
 
92
  text = f"{text} {verification_of_final_answer}"
93
- print_coso(f"__call__ text2: {text}")
94
  # Se è presente un file, gestiscilo
95
 
96
  risposta = ""
@@ -101,7 +101,7 @@ class BasicAgent:
101
  response = self._ask_gpt4o_with_image(image, text)
102
  risposta = response
103
 
104
- elif file_info.endswith(".wav") or file_name.endswith(".mp3"):
105
  print("coso Audio file detected, processing with Whisper")
106
  audio_bytes = self._load_bytes(file_info)
107
  transcription = self._transcribe_audio(audio_bytes)
@@ -201,33 +201,14 @@ def get_or_download_image(file_name: str) -> Image.Image:
201
  print(f"[ERRORE] Impossibile aprire l'immagine {file_path}: {e}")
202
  return None
203
 
204
- def download_file_if_needed(file_name):
205
- if not file_name:
206
- return None
207
-
208
- local_path = f"/mnt/data/{file_name}"
209
- if os.path.exists(local_path):
210
- return local_path
211
 
 
212
  base_url = "https://huggingface.co/datasets/gaia-benchmark/GAIA/resolve"
213
  commit_hash = "86620fe7a265fdd074ea8d8c8b7a556a1058b0af"
214
  full_url = f"{base_url}/{commit_hash}/2023/validation/{file_name}"
215
-
216
- response = requests.get(full_url)
217
- if response.status_code == 200:
218
- with open(local_path, "wb") as f:
219
- f.write(response.content)
220
- return local_path
221
- else:
222
- print(f"Failed to download {file_name}: {response.status_code}")
223
- return None
224
-
225
 
226
  def create_mock_questions():
227
- #with open("data/A_photograph_captures_a_domestic_kitchen_scene_dur.png", "rb") as img_file:
228
- # img_bytes = img_file.read()
229
- # img_base64 = base64.b64encode(img_bytes).decode("utf-8")
230
-
231
 
232
  '''
233
  {
 
90
  print_coso(f"__call__ file_info: {file_info}")
91
 
92
  text = f"{text} {verification_of_final_answer}"
93
+
94
  # Se è presente un file, gestiscilo
95
 
96
  risposta = ""
 
101
  response = self._ask_gpt4o_with_image(image, text)
102
  risposta = response
103
 
104
+ elif file_info.endswith(".wav") or file_info.endswith(".mp3"):
105
  print("coso Audio file detected, processing with Whisper")
106
  audio_bytes = self._load_bytes(file_info)
107
  transcription = self._transcribe_audio(audio_bytes)
 
201
  print(f"[ERRORE] Impossibile aprire l'immagine {file_path}: {e}")
202
  return None
203
 
 
 
 
 
 
 
 
204
 
205
+ '''
206
  base_url = "https://huggingface.co/datasets/gaia-benchmark/GAIA/resolve"
207
  commit_hash = "86620fe7a265fdd074ea8d8c8b7a556a1058b0af"
208
  full_url = f"{base_url}/{commit_hash}/2023/validation/{file_name}"
209
+ '''
 
 
 
 
 
 
 
 
 
210
 
211
  def create_mock_questions():
 
 
 
 
212
 
213
  '''
214
  {