A newer version of the Streamlit SDK is available: 1.56.0
Quick Deployment to Hugging Face Space
This script helps you sync your code to Hugging Face
OPTION 1: Upload via Python Script (Easiest)
Get your Hugging Face token:
- Go to: https://huggingface.co/settings/tokens
- Click "New token" β Create a WRITE token
- Copy the token
Run the upload script:
cd d:\Documents\SFU\PHYS385_Quantum2\CodeProjects\Hand-wave python upload_to_hf.pyPaste your token when prompted
Done! Check your Space: https://huggingface.co/spaces/AhiBucket/Hand-wave
OPTION 2: Clone HF Space and Push (Alternative)
If Option 1 doesn't work, try this:
# 1. Clone the Hugging Face Space
cd d:\Documents\SFU\PHYS385_Quantum2\CodeProjects
git clone https://huggingface.co/spaces/AhiBucket/Hand-wave hf-hand-wave
# 2. Copy files
cd hf-hand-wave
Copy-Item -Path "..\Hand-wave\app.py" -Destination "." -Force
Copy-Item -Path "..\Hand-wave\functions.py" -Destination "." -Force
Copy-Item -Path "..\Hand-wave\requirements.txt" -Destination "." -Force
Copy-Item -Path "..\Hand-wave\README.md" -Destination "." -Force
# 3. Commit and push
git add .
git commit -m "Fix: Plotly compatibility for wavefunction display"
git push
When prompted for credentials:
- Username: Your Hugging Face username
- Password: Your Hugging Face WRITE token (NOT your password!)
Files Ready for Deployment β
All files have been prepared in: d:\Documents\SFU\PHYS385_Quantum2\CodeProjects\Hand-wave
- β app.py (with Plotly fixes)
- β functions.py (physics engine)
- β requirements.txt (dependencies)
- β README.md (documentation)
- β .gitignore
What Was Fixed π§
The main issue causing wavefunctions not to display on Hugging Face:
- Array dimension validation - Ensures x and y arrays match in length
- Data type conversion - Converts numpy arrays to lists for Plotly compatibility
- Explicit array handling - Uses x_internal explicitly instead of inline slicing
These fixes ensure the app works on both local Streamlit and Hugging Face Spaces!