import gradio as gr import random import json import fastapi from fastapi import FastAPI # Create a FastAPI app app = FastAPI() # Sample country data with random progress percentages def generate_data(): return { "MX": {"name": "Mexico", "percent": random.randint(10, 90)}, "AR": {"name": "Argentina", "percent": random.randint(10, 90)}, "CO": {"name": "Colombia", "percent": random.randint(10, 90)}, "CL": {"name": "Chile", "percent": random.randint(10, 90)}, "PE": {"name": "Peru", "percent": random.randint(10, 90)}, "ES": {"name": "Spain", "percent": random.randint(10, 90)}, "BR": {"name": "Brazil", "percent": random.randint(10, 90)}, "VE": {"name": "Venezuela", "percent": random.randint(10, 90)}, "EC": {"name": "Ecuador", "percent": random.randint(10, 90)}, "BO": {"name": "Bolivia", "percent": random.randint(10, 90)}, "PY": {"name": "Paraguay", "percent": random.randint(10, 90)}, "UY": {"name": "Uruguay", "percent": random.randint(10, 90)}, "CR": {"name": "Costa Rica", "percent": random.randint(10, 90)}, "PA": {"name": "Panama", "percent": random.randint(10, 90)}, "DO": {"name": "Dominican Republic", "percent": random.randint(10, 90)}, "GT": {"name": "Guatemala", "percent": random.randint(10, 90)}, "HN": {"name": "Honduras", "percent": random.randint(10, 90)}, "SV": {"name": "El Salvador", "percent": random.randint(10, 90)}, "NI": {"name": "Nicaragua", "percent": random.randint(10, 90)}, "CU": {"name": "Cuba", "percent": random.randint(10, 90)} } # HTML template - avoiding f-strings with JavaScript template literals HTML_TEMPLATE = """