import os import time from huggingface_hub import HfApi import gradio as gr api = HfApi(token=os.environ["HF_TOKEN"]) def save_and_show(uploaded): filename = os.path.basename(uploaded.name) api.upload_file( path_or_fileobj=uploaded.name, path_in_repo=filename, repo_id="osaaso/registrations", repo_type="dataset" ) time.sleep(1) pdf_url = f"https://huggingface.co/datasets/osaaso/registrations/resolve/main/{filename}" html = f""" """ return html demo = gr.Interface( fn=save_and_show, inputs=gr.File(type="filepath"), outputs=gr.HTML() ) demo.launch()