Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- Run +0 -0
- requirements.txt +15 -3
- setup_data.py +108 -0
Run
ADDED
|
File without changes
|
requirements.txt
CHANGED
|
@@ -1,3 +1,15 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit==1.28.0
|
| 2 |
+
requests==2.31.0
|
| 3 |
+
python-dotenv==1.0.0
|
| 4 |
+
pandas==2.1.4
|
| 5 |
+
numpy==1.26.0
|
| 6 |
+
plotly==5.17.0
|
| 7 |
+
streamlit-authenticator==0.2.3
|
| 8 |
+
streamlit-lottie==0.0.5
|
| 9 |
+
streamlit-extras==0.3.5
|
| 10 |
+
pillow==10.1.0
|
| 11 |
+
streamlit-mic-recorder
|
| 12 |
+
|
| 13 |
+
googletrans==4.0.0-rc1
|
| 14 |
+
|
| 15 |
+
transformers
|
setup_data.py
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# setup_data.py
|
| 2 |
+
"""Setup script to create data directory and sample files"""
|
| 3 |
+
|
| 4 |
+
import os
|
| 5 |
+
import json
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def setup_data_directory():
|
| 9 |
+
"""Create data directory and sample files"""
|
| 10 |
+
|
| 11 |
+
# Create data directory if it doesn't exist
|
| 12 |
+
os.makedirs("data", exist_ok=True)
|
| 13 |
+
print("Created 'data' directory")
|
| 14 |
+
|
| 15 |
+
# Sample users data
|
| 16 |
+
users_data = {
|
| 17 |
+
"demo_user": {
|
| 18 |
+
"password": "5994471abb01112afcc18159f6cc74b4f511b99806da59b3caf5a9c173cacfc5", # password: 12345
|
| 19 |
+
"email": "demo@example.com",
|
| 20 |
+
"created": "2024-01-01T00:00:00",
|
| 21 |
+
"last_login": "2024-01-01T00:00:00",
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
# Sample scores data
|
| 26 |
+
scores_data = {
|
| 27 |
+
"demo_user": {
|
| 28 |
+
"total_score": 1500,
|
| 29 |
+
"quizzes_completed": 15,
|
| 30 |
+
"badges": ["beginner", "learner"],
|
| 31 |
+
"achievements": ["first_quiz", "streak_5"],
|
| 32 |
+
"quiz_history": [
|
| 33 |
+
{
|
| 34 |
+
"timestamp": "2024-01-01T10:00:00",
|
| 35 |
+
"mode": "MCQ Quiz",
|
| 36 |
+
"score": 8,
|
| 37 |
+
"total": 10,
|
| 38 |
+
"difficulty": "Medium",
|
| 39 |
+
"percentage": 80.0,
|
| 40 |
+
}
|
| 41 |
+
],
|
| 42 |
+
"stats": {
|
| 43 |
+
"mcq": {"played": 50, "correct": 40},
|
| 44 |
+
"flashcards": {"played": 30, "completed": 25},
|
| 45 |
+
"facts": {"played": 20, "score": 18},
|
| 46 |
+
},
|
| 47 |
+
"streaks": {"current": 3, "best": 7},
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
# Sample performance data
|
| 52 |
+
performance_data = {
|
| 53 |
+
"performance_history": [
|
| 54 |
+
{
|
| 55 |
+
"timestamp": "2024-01-01T10:00:00",
|
| 56 |
+
"correct": True,
|
| 57 |
+
"difficulty": "Medium",
|
| 58 |
+
"topic": "Python programming",
|
| 59 |
+
}
|
| 60 |
+
],
|
| 61 |
+
"difficulty_scores": {"Easy": 0.85, "Medium": 0.65, "Hard": 0.45},
|
| 62 |
+
"topic_performance": {
|
| 63 |
+
"Python programming": {
|
| 64 |
+
"attempts": 10,
|
| 65 |
+
"correct": 8,
|
| 66 |
+
"last_seen": "2024-01-01T10:00:00",
|
| 67 |
+
}
|
| 68 |
+
},
|
| 69 |
+
"last_updated": "2024-01-01T10:00:00",
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
# Sample leaderboard data
|
| 73 |
+
leaderboard_data = [
|
| 74 |
+
{"rank": 1, "username": "demo_user", "score": 1500, "badges": 2, "quizzes": 15}
|
| 75 |
+
]
|
| 76 |
+
|
| 77 |
+
# Write sample files
|
| 78 |
+
files_to_create = {
|
| 79 |
+
"data/users.json": users_data,
|
| 80 |
+
"data/user_scores.json": scores_data,
|
| 81 |
+
"data/scores_demo_user.json": scores_data["demo_user"],
|
| 82 |
+
"data/performance_demo_user.json": performance_data,
|
| 83 |
+
"data/leaderboard.json": leaderboard_data,
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
for filename, data in files_to_create.items():
|
| 87 |
+
with open(filename, "w") as f:
|
| 88 |
+
json.dump(data, f, indent=2)
|
| 89 |
+
print(f"Created '{filename}'")
|
| 90 |
+
|
| 91 |
+
# Create placeholder for future features
|
| 92 |
+
placeholder_files = [
|
| 93 |
+
"data/.gitkeep", # Ensures data folder is tracked by git
|
| 94 |
+
]
|
| 95 |
+
|
| 96 |
+
for filename in placeholder_files:
|
| 97 |
+
with open(filename, "w") as f:
|
| 98 |
+
f.write("")
|
| 99 |
+
print(f"Created '{filename}'")
|
| 100 |
+
|
| 101 |
+
print("\nData directory setup complete!")
|
| 102 |
+
print("\nDemo credentials:")
|
| 103 |
+
print(" Username: demo_user")
|
| 104 |
+
print(" Password: 12345")
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
if __name__ == "__main__":
|
| 108 |
+
setup_data_directory()
|