import boto3 import os import re import json from pathlib import Path from huggingface_hub import Repository, HfFolder import tqdm import subprocess from fastapi import FastAPI from fastapi_utils.tasks import repeat_every from datasets import load_dataset, Image def get_datasetdata(dataset_path): def sync_discussion_to_dataset(): dataset = load_dataset("beans", split="train") dataset[0]["image"] app = FastAPI() @app.post("/") def read_root(): return "Just a bot to push data to huggingface datasets " @app.post("/sync") def sync(): sync_rooms_to_dataset() return "Synced data to huggingface datasets" @app.on_event("startup") @repeat_every(seconds=1800) def repeat_sync(): sync_to_dataset() return "Synced data to huggingface datasets"