iyadsultan commited on
Commit
97ff33b
·
1 Parent(s): 1e0ba61
Files changed (3) hide show
  1. Dockerfile +7 -8
  2. app.py +7 -15
  3. templates/debug.html +0 -10
Dockerfile CHANGED
@@ -2,17 +2,16 @@ FROM python:3.10-slim
2
 
3
  WORKDIR /app
4
 
 
 
 
 
5
  COPY requirements.txt .
6
  RUN pip install --no-cache-dir -r requirements.txt
7
 
8
  COPY . .
9
 
10
- # Make sure the app is accessible
11
- CMD ["python", "app.py"]
12
-
13
- # Add these lines to ensure proper permissions
14
- RUN mkdir -p /data && \
15
- chown -R 1000:1000 /data && \
16
- chmod -R 755 /data
17
 
18
- VOLUME /data
 
2
 
3
  WORKDIR /app
4
 
5
+ # Create data directory with proper permissions first
6
+ RUN mkdir -p /data && \
7
+ chmod -R 755 /data
8
+
9
  COPY requirements.txt .
10
  RUN pip install --no-cache-dir -r requirements.txt
11
 
12
  COPY . .
13
 
14
+ # Ensure the data directory persists
15
+ VOLUME /data
 
 
 
 
 
16
 
17
+ CMD ["python", "app.py"]
app.py CHANGED
@@ -486,21 +486,14 @@ def debug():
486
 
487
  # Get evaluations
488
  evaluations, _, _ = get_results()
489
- if not evaluations.empty:
490
- evaluations = evaluations.to_dict('records')
491
- else:
492
- evaluations = []
493
-
494
- # Check if files exist
495
- documents_exists = os.path.exists(os.path.join(DATA_DIR, 'documents.csv'))
496
- evaluations_exists = os.path.exists(os.path.join(DATA_DIR, 'evaluations.csv'))
497
 
498
  return render_template('debug.html',
499
- documents=documents,
500
- evaluations=evaluations,
501
- documents_exists=documents_exists,
502
- evaluations_exists=evaluations_exists,
503
- errors=ERROR_LOG)
 
504
 
505
  @app.route('/instructions')
506
  def view_instructions():
@@ -547,9 +540,8 @@ def reset():
547
  return redirect(url_for('index'))
548
 
549
  if __name__ == '__main__':
550
- # Create data directory if it doesn't exist with proper permissions
551
  os.makedirs(DATA_DIR, exist_ok=True)
552
- os.chmod(DATA_DIR, 0o755) # Set directory permissions
553
 
554
  # Set debug mode for troubleshooting
555
  app.config['DEBUG'] = True
 
486
 
487
  # Get evaluations
488
  evaluations, _, _ = get_results()
 
 
 
 
 
 
 
 
489
 
490
  return render_template('debug.html',
491
+ documents=documents,
492
+ evaluations=evaluations,
493
+ documents_exists=os.path.exists('data/documents.csv'),
494
+ evaluations_exists=os.path.exists('data/evaluations.csv'),
495
+ errors=ERROR_LOG
496
+ )
497
 
498
  @app.route('/instructions')
499
  def view_instructions():
 
540
  return redirect(url_for('index'))
541
 
542
  if __name__ == '__main__':
543
+ # Create data directory if it doesn't exist
544
  os.makedirs(DATA_DIR, exist_ok=True)
 
545
 
546
  # Set debug mode for troubleshooting
547
  app.config['DEBUG'] = True
templates/debug.html CHANGED
@@ -108,16 +108,6 @@
108
  {% endif %}
109
  </span>
110
  </div>
111
- <div class="debug-item">
112
- <span class="key">evaluations.csv</span>:
113
- <span class="value">
114
- {% if evaluations_exists %}
115
- <span class="success">File exists</span>
116
- {% else %}
117
- <span class="error">File does not exist</span>
118
- {% endif %}
119
- </span>
120
- </div>
121
  </div>
122
 
123
  <div class="section">
 
108
  {% endif %}
109
  </span>
110
  </div>
 
 
 
 
 
 
 
 
 
 
111
  </div>
112
 
113
  <div class="section">