Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,6 @@ import json
|
|
23 |
from PIL import Image
|
24 |
from io import BytesIO
|
25 |
|
26 |
-
NUMERO_DOMANDE_TOTALE = 20
|
27 |
|
28 |
set_global_handler("simple") # imposta un handler semplice per il logging
|
29 |
logging.getLogger().setLevel(logging.DEBUG) # imposta il livello di log a DEBUG
|
@@ -208,6 +207,7 @@ def get_or_download_image(file_name: str) -> Image.Image:
|
|
208 |
full_url = f"{base_url}/{commit_hash}/2023/validation/{file_name}"
|
209 |
'''
|
210 |
|
|
|
211 |
def create_mock_questions():
|
212 |
|
213 |
'''
|
@@ -273,15 +273,17 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
273 |
print(f"Fetching questions from: {questions_url}")
|
274 |
try:
|
275 |
#qui per servizio get domande
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
|
|
|
|
280 |
|
281 |
print("\n\n")
|
282 |
print(f"total_questions: {total_questions}")
|
283 |
print("\n\n")
|
284 |
-
questions_data = total_questions[:min(
|
285 |
print_coso(f"questions_data: {questions_data}")
|
286 |
if not questions_data:
|
287 |
print("Fetched questions list is empty.")
|
|
|
23 |
from PIL import Image
|
24 |
from io import BytesIO
|
25 |
|
|
|
26 |
|
27 |
set_global_handler("simple") # imposta un handler semplice per il logging
|
28 |
logging.getLogger().setLevel(logging.DEBUG) # imposta il livello di log a DEBUG
|
|
|
207 |
full_url = f"{base_url}/{commit_hash}/2023/validation/{file_name}"
|
208 |
'''
|
209 |
|
210 |
+
DOMANDE_MOCKATE = False
|
211 |
def create_mock_questions():
|
212 |
|
213 |
'''
|
|
|
273 |
print(f"Fetching questions from: {questions_url}")
|
274 |
try:
|
275 |
#qui per servizio get domande
|
276 |
+
if DOMANDE_MOCKATE:
|
277 |
+
total_questions = create_mock_questions()
|
278 |
+
else:
|
279 |
+
response = requests.get(questions_url, timeout=15)
|
280 |
+
response.raise_for_status()
|
281 |
+
total_questions = response.json()
|
282 |
|
283 |
print("\n\n")
|
284 |
print(f"total_questions: {total_questions}")
|
285 |
print("\n\n")
|
286 |
+
questions_data = total_questions[:min(20, len(total_questions))]
|
287 |
print_coso(f"questions_data: {questions_data}")
|
288 |
if not questions_data:
|
289 |
print("Fetched questions list is empty.")
|