AdityaAdaki commited on
Commit
a1419c7
·
2 Parent(s): f510322 d6a210f

Merge branch 'main' of https://huggingface.co/spaces/sikeaditya/crop_market_analysis

Browse files
Files changed (3) hide show
  1. Dockerfile +9 -26
  2. app.py +2 -2
  3. templates/{index.html → index1.html} +0 -0
Dockerfile CHANGED
@@ -1,36 +1,19 @@
1
  FROM python:3.9-slim
2
 
 
3
  WORKDIR /app
4
 
5
- # Create structure first
6
- RUN mkdir -p /app/static/audio
7
- RUN mkdir -p /app/templates
8
 
9
- # Set permissions
10
- RUN chmod -R 777 /app/static
11
 
12
- # Install system dependencies
13
- RUN apt-get update && \
14
- apt-get install -y --no-install-recommends \
15
- espeak \
16
- libespeak1 \
17
- && rm -rf /var/lib/apt/lists/*
18
-
19
- # Copy files
20
- COPY requirements.txt .
21
- COPY app.py .
22
- COPY final_price_data.csv .
23
- COPY static /app/static/
24
- COPY templates /app/templates/
25
-
26
- # Install Python dependencies
27
  RUN pip install --no-cache-dir -r requirements.txt
28
 
29
- # Make sure the port is exposed
30
  EXPOSE 7860
31
 
32
- # Set environment variable to tell Flask what to run
33
- ENV FLASK_APP=app.py
34
-
35
- # Using gunicorn as the WSGI server can be more reliable
36
- CMD ["python", "-m", "flask", "run", "--host=0.0.0.0", "--port=7860"]
 
1
  FROM python:3.9-slim
2
 
3
+ # Set the working directory
4
  WORKDIR /app
5
 
6
+ # Create and set permissions for the audio directory in the correct path (/app/static/audio)
7
+ RUN mkdir -p /app/static/audio && chmod 777 /app/static/audio
 
8
 
9
+ # Copy application files
10
+ COPY . /app
11
 
12
+ # Install dependencies
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  RUN pip install --no-cache-dir -r requirements.txt
14
 
15
+ # Expose the port your app runs on
16
  EXPOSE 7860
17
 
18
+ # Command to run the application
19
+ CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "app:app"]
 
 
 
app.py CHANGED
@@ -29,7 +29,7 @@ def fetch_market_data(state=None, district=None, market=None, commodity=None):
29
  Filters (state, district, market, commodity) are applied manually on CSV data.
30
  """
31
  api_key = "579b464db66ec23bdd000001189bbb99e979428764bdbe8fdd44ebb7"
32
- base_url = "1https://api.data.gov.in/resource/9ef84268-d588-465a-a308-a864a43d007"
33
 
34
  params = {
35
  "api-key": api_key,
@@ -549,4 +549,4 @@ def serve_audio(filename):
549
 
550
  if __name__ == '__main__':
551
  pio.templates.default = "plotly_white"
552
- app.run(debug=True, host='0.0.0.0', port=7860)
 
29
  Filters (state, district, market, commodity) are applied manually on CSV data.
30
  """
31
  api_key = "579b464db66ec23bdd000001189bbb99e979428764bdbe8fdd44ebb7"
32
+ base_url = "https://api.data.gov.in/resource/9ef84268-d588-465a-a308-a864a43d007"
33
 
34
  params = {
35
  "api-key": api_key,
 
549
 
550
  if __name__ == '__main__':
551
  pio.templates.default = "plotly_white"
552
+ app.run(app=app1,debug=True, host='0.0.0.0', port=7860)
templates/{index.html → index1.html} RENAMED
File without changes