import gradio as gr def GetFile(): return "https://huggingface.co/spaces/rrg92/GradioApiBug/raw/main/SampleFile.txt" with gr.Blocks(): gr.Markdown("This space shows a problem with Gradio API when used inside Hugging Face Space.") gr.Markdown("You can you any favorite http client to reproduce that. Use sample code bellow as reference") gt.markdown("*Problem*: File url returned by Gradio API is incorrect") btn = gr.Button("Click that button to start!") fileResult = gr.File() btn.click( GetFile, None, [fileResult] ) if __name__ == "__main__": demo.launch(show_api=True)