tdurzynski commited on
Commit
cd5f99a
Β·
verified Β·
1 Parent(s): b6760e7

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +133 -14
README.md CHANGED
@@ -1,14 +1,133 @@
1
- ---
2
- title: Food Image Crowdsourcing
3
- emoji: πŸ¦€
4
- colorFrom: indigo
5
- colorTo: indigo
6
- sdk: streamlit
7
- sdk_version: 1.43.2
8
- app_file: app.py
9
- pinned: false
10
- license: apache-2.0
11
- short_description: This app lets users participate in research on food habits
12
- ---
13
-
14
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 🍽️ Food Image Crowdsourcing App
2
+
3
+ A Streamlit application that allows users to upload food images for AI model training. These images will be used to fine-tune datasets for food image recognition to annotate uploaded food pictures with caloric and nutrient values.
4
+
5
+ ## πŸ“‹ Features
6
+
7
+ - User authentication via Firebase
8
+ - Image upload and processing
9
+ - Token reward system for contributors
10
+ - AWS S3 storage for images
11
+ - DynamoDB for metadata storage
12
+
13
+ ## πŸš€ Deployment to Hugging Face Spaces
14
+
15
+ ### Prerequisites
16
+
17
+ 1. [Hugging Face](https://huggingface.co/) account
18
+ 2. AWS account with S3 and DynamoDB
19
+ 3. Firebase project for authentication
20
+
21
+ ### Step 1: Set up AWS Resources
22
+
23
+ 1. Create an S3 bucket: `food-image-crowdsourcing`
24
+ 2. Create a DynamoDB table: `image_metadata` with primary key `image_id`
25
+ 3. Create an IAM user with permissions for S3 and DynamoDB
26
+ 4. Note your AWS Access Key and Secret Key
27
+
28
+ ### Step 2: Set up Firebase Authentication
29
+
30
+ 1. Create a new Firebase project at [Firebase Console](https://console.firebase.google.com/)
31
+ 2. Enable Email/Password authentication
32
+ 3. Generate a new private key for your service account (Project settings > Service accounts > Generate new private key)
33
+ 4. Save the JSON file
34
+
35
+ ### Step 3: Create a New Hugging Face Space
36
+
37
+ 1. Go to [Hugging Face Spaces](https://huggingface.co/spaces)
38
+ 2. Click "Create new Space"
39
+ 3. Choose a name for your Space
40
+ 4. Select "Streamlit" as the SDK
41
+ 5. Choose visibility (Public or Private)
42
+ 6. Click "Create Space"
43
+
44
+ ### Step 4: Upload Files to the Space
45
+
46
+ Upload the following files to your Space:
47
+ - `app.py`
48
+ - `requirements.txt`
49
+ - `PARTICIPATION_GUIDELINES.md`
50
+ - `TOKEN_REWARDS.md`
51
+ - `TERMS_OF_SERVICE.md`
52
+
53
+ You can do this via the Hugging Face web interface or using Git.
54
+
55
+ ### Step 5: Configure Secrets
56
+
57
+ 1. Go to your Space's Settings tab
58
+ 2. Under "Repository secrets", add the following secrets:
59
+ - `AWS_ACCESS_KEY`: Your AWS access key
60
+ - `AWS_SECRET_KEY`: Your AWS secret key
61
+ - `AWS_REGION`: Your AWS region (e.g., `us-east-1`)
62
+ - `S3_BUCKET_NAME`: Your S3 bucket name (e.g., `food-image-crowdsourcing`)
63
+ - `DYNAMODB_TABLE`: Your DynamoDB table name (e.g., `image_metadata`)
64
+ - `FIREBASE_CONFIG`: Paste the entire content of your Firebase service account JSON file
65
+
66
+ ### Step 6: Deploy and Run
67
+
68
+ 1. Your Space should automatically build and deploy when you push your changes
69
+ 2. If not, you can manually rebuild from the Settings tab
70
+ 3. Once deployed, you can access your app at `https://huggingface.co/spaces/your-username/your-space-name`
71
+
72
+ ## πŸ“„ Important Files
73
+
74
+ - `app.py`: The main Streamlit application
75
+ - `requirements.txt`: Python dependencies
76
+ - `PARTICIPATION_GUIDELINES.md`: Rules for user participation
77
+ - `TOKEN_REWARDS.md`: Explanation of the token reward system
78
+ - `TERMS_OF_SERVICE.md`: Legal terms and conditions
79
+
80
+ ## πŸ”„ Local Development
81
+
82
+ To run this application locally:
83
+
84
+ 1. Clone the repository
85
+ 2. Install dependencies: `pip install -r requirements.txt`
86
+ 3. Create a `.env` file with the required environment variables
87
+ 4. Run the app: `streamlit run app.py`
88
+
89
+ ## πŸ“¦ Required Environment Variables
90
+
91
+ ```
92
+ AWS_ACCESS_KEY=your_aws_access_key
93
+ AWS_SECRET_KEY=your_aws_secret_key
94
+ AWS_REGION=your_aws_region
95
+ S3_BUCKET_NAME=your_s3_bucket_name
96
+ DYNAMODB_TABLE=your_dynamodb_table_name
97
+ FIREBASE_CONFIG=your_firebase_json_config
98
+ ```
99
+
100
+ ## πŸ“Š Data Model
101
+
102
+ ### S3 Object Structure
103
+
104
+ Images are stored in S3 with the following path pattern:
105
+ ```
106
+ {user_id}/{timestamp}_{image_id}.jpg
107
+ ```
108
+
109
+ ### DynamoDB Schema
110
+
111
+ Each image entry in DynamoDB contains:
112
+ - `image_id` (Primary Key): UUID for the image
113
+ - `user_id`: ID of the uploading user
114
+ - `upload_timestamp`: When the image was uploaded
115
+ - `food_name`: Name of the food
116
+ - `portion_size`: Size/weight of the portion
117
+ - `portion_unit`: Unit of measurement
118
+ - `cooking_method`: How the food was prepared
119
+ - `ingredients`: List of main ingredients
120
+ - `s3_path`: Path to the image in S3
121
+ - `tokens_awarded`: Number of tokens awarded for this upload
122
+
123
+ ## πŸ› οΈ Future Enhancements
124
+
125
+ 1. Image tagging with machine learning
126
+ 2. Nutritional information estimation
127
+ 3. Social sharing features
128
+ 4. Mobile app integration
129
+ 5. Enhanced analytics dashboard
130
+
131
+ ## πŸ“ License
132
+
133
+ This project is licensed under the MIT License - see the LICENSE file for details.