Spaces:
Sleeping
Sleeping
Fix: Remove detection logic for HuggingFace Spaces compatibility
Browse files- Simplified app.py to remove streamlit execution detection
- Fixed README.md header to use 'streamlit' SDK instead of 'gradio'
- App now works correctly in both local and cloud deployment environments
- Warnings about ScriptRunContext are harmless and can be ignored in deployment
- README.md +6 -5
- app.py +3 -17
- chroma_db/chroma.sqlite3 +1 -1
README.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title: Scikit
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: blue
|
| 5 |
-
colorTo:
|
| 6 |
-
sdk:
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Scikit-learn Documentation Q&A Bot
|
| 3 |
+
emoji: 🤖
|
| 4 |
colorFrom: blue
|
| 5 |
+
colorTo: green
|
| 6 |
+
sdk: streamlit
|
| 7 |
+
sdk_version: 1.28.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
+
license: mit
|
| 11 |
---
|
| 12 |
|
| 13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
|
@@ -488,21 +488,7 @@ def main():
|
|
| 488 |
|
| 489 |
|
| 490 |
if __name__ == "__main__":
|
| 491 |
-
#
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
# Check if this is being run directly with python (not via streamlit)
|
| 495 |
-
# When run with streamlit, sys.argv[0] typically contains 'streamlit' or the script is run in a different context
|
| 496 |
-
if len(sys.argv) == 1 and 'streamlit' not in sys.modules:
|
| 497 |
-
print("⚠️ This is a Streamlit application!")
|
| 498 |
-
print("🚀 Please run it with: streamlit run app.py")
|
| 499 |
-
print()
|
| 500 |
-
print("📝 Instructions:")
|
| 501 |
-
print("1. Make sure you have streamlit installed: pip install streamlit")
|
| 502 |
-
print("2. Run the app: streamlit run app.py")
|
| 503 |
-
print("3. Enter your OpenAI API key in the sidebar")
|
| 504 |
-
print("4. Start asking questions about Scikit-learn!")
|
| 505 |
-
sys.exit(0)
|
| 506 |
-
|
| 507 |
-
# If we get here, we're likely running via streamlit
|
| 508 |
main()
|
|
|
|
| 488 |
|
| 489 |
|
| 490 |
if __name__ == "__main__":
|
| 491 |
+
# Run the main application
|
| 492 |
+
# Note: For deployment environments like HuggingFace Spaces,
|
| 493 |
+
# Streamlit warnings about missing ScriptRunContext can be safely ignored
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 494 |
main()
|
chroma_db/chroma.sqlite3
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 13279232
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7da052d90807d731532e1195c8fbd4478b133ff07654b8ed5798dfd2d30b7a90
|
| 3 |
size 13279232
|