GattoNero commited on
Commit
f2cec54
·
verified ·
1 Parent(s): fbe5fbd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -18,7 +18,6 @@ from llama_index.llms.openai import OpenAI
18
  #per i file multimediali
19
  import base64
20
  import json
21
- import requests
22
  from PIL import Image
23
  from io import BytesIO
24
 
@@ -149,7 +148,17 @@ class BasicAgent:
149
 
150
 
151
 
 
 
 
 
152
 
 
 
 
 
 
 
153
 
154
 
155
 
@@ -197,7 +206,8 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
197
  try:
198
  response = requests.get(questions_url, timeout=15)
199
  response.raise_for_status()
200
- total_questions = response.json()
 
201
  questions_data = total_questions[:NUMERO_DOMANDE_TOTALE]
202
  if not questions_data:
203
  print("Fetched questions list is empty.")
 
18
  #per i file multimediali
19
  import base64
20
  import json
 
21
  from PIL import Image
22
  from io import BytesIO
23
 
 
148
 
149
 
150
 
151
+ def create_mock_questions():
152
+ with open("/mnt/data/A_photograph_captures_a_domestic_kitchen_scene_dur.png", "rb") as img_file:
153
+ img_bytes = img_file.read()
154
+ img_base64 = base64.b64encode(img_bytes).decode("utf-8")
155
 
156
+ return [{
157
+ "task_id": "mock-image-001",
158
+ "question": "Contando solo i frutti maturi visibili, quanti limoni ci sono in questa cucina?",
159
+ "image": img_base64,
160
+ "image_type": "image/png"
161
+ }]
162
 
163
 
164
 
 
206
  try:
207
  response = requests.get(questions_url, timeout=15)
208
  response.raise_for_status()
209
+ #total_questions = response.json()
210
+ total_questions = create_mock_questions()
211
  questions_data = total_questions[:NUMERO_DOMANDE_TOTALE]
212
  if not questions_data:
213
  print("Fetched questions list is empty.")