pilotstuki Claude commited on
Commit
3dce5a4
·
1 Parent(s): a2551a8

Fix file upload CORS issue for HF Spaces

Browse files

- Add .streamlit/config.toml with proper server configuration
- Disable CORS and XSRF protection for HF Spaces compatibility
- Set maxUploadSize to 1024MB for large log files
- Update .gitignore to include .streamlit config
- Update Dockerfile to copy .streamlit directory

This fixes the axios 403 error when users upload files.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (3) hide show
  1. .gitignore +2 -2
  2. .streamlit/config.toml +24 -0
  3. Dockerfile +3 -0
.gitignore CHANGED
@@ -23,8 +23,8 @@ wheels/
23
  .installed.cfg
24
  *.egg
25
 
26
- # Streamlit
27
- .streamlit/
28
 
29
  # Log files (example/sample files - users will upload their own)
30
  *.log
 
23
  .installed.cfg
24
  *.egg
25
 
26
+ # Streamlit (keep .streamlit/config.toml for HF Spaces configuration)
27
+ # .streamlit/secrets.toml should remain private if you add it
28
 
29
  # Log files (example/sample files - users will upload their own)
30
  *.log
.streamlit/config.toml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [server]
2
+ # Server configuration for Hugging Face Spaces
3
+ headless = true
4
+ port = 7860
5
+ address = "0.0.0.0"
6
+ enableCORS = false
7
+ enableXsrfProtection = false
8
+
9
+ # File upload settings
10
+ maxUploadSize = 1024
11
+ maxMessageSize = 1024
12
+
13
+ [browser]
14
+ # Browser settings
15
+ gatherUsageStats = false
16
+ serverAddress = "0.0.0.0"
17
+ serverPort = 7860
18
+
19
+ [theme]
20
+ # Optional: Set theme
21
+ primaryColor = "#1f77b4"
22
+ backgroundColor = "#ffffff"
23
+ secondaryBackgroundColor = "#f0f2f6"
24
+ textColor = "#262730"
Dockerfile CHANGED
@@ -31,6 +31,9 @@ RUN pip install --no-cache-dir -r requirements.txt
31
  COPY --chown=user:user app.py .
32
  COPY --chown=user:user log_parser.py .
33
 
 
 
 
34
  # Expose port 7860 (Hugging Face Spaces default)
35
  EXPOSE 7860
36
 
 
31
  COPY --chown=user:user app.py .
32
  COPY --chown=user:user log_parser.py .
33
 
34
+ # Copy Streamlit configuration for HF Spaces
35
+ COPY --chown=user:user .streamlit .streamlit
36
+
37
  # Expose port 7860 (Hugging Face Spaces default)
38
  EXPOSE 7860
39