Skip to content

Instantly share code, notes, and snippets.

@lewtun
Created November 22, 2022 12:30
Show Gist options
  • Save lewtun/145e2734766203e9f5e945200d89db3a to your computer and use it in GitHub Desktop.
Save lewtun/145e2734766203e9f5e945200d89db3a to your computer and use it in GitHub Desktop.
[HF Course] Format Gradio URLs
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lewtun
Copy link
Author

lewtun commented Nov 22, 2022

The new_url can't really be guessed from the Space ID, so a more rigorous approach is to ping

https://huggingface.co/api/spaces/course-demos/{space_id}/host

and extract the real URL from there. For now, I've left the code untouched since the required fixes were easy to handle manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment