Vibi007 commited on
Commit
621bbc1
·
1 Parent(s): b41be4b

added supervisor

Browse files
Dockerfile CHANGED
@@ -37,6 +37,12 @@ WORKDIR /app
37
  # Install serve globally to serve the React app
38
  RUN pip install uvicorn fastapi tqdm wikitextparser pydantic requests beautifulsoup4 && apt-get update && apt-get install -y nodejs npm && npm install -g serve
39
 
 
 
 
 
 
 
40
  # Copy built frontend from the first stage
41
  COPY --from=frontend-builder /app/frontend/build /app/frontend/build
42
 
@@ -47,5 +53,5 @@ COPY --from=backend-builder /app/backend /app/backend
47
  EXPOSE 7860
48
  EXPOSE 8000
49
 
50
- # Start both frontend and backend
51
- CMD ["sh", "-c", "cd /app/backend && uvicorn main:app --host 0.0.0.0 --port 8000 & serve -s /app/frontend/build -l 7860"]
 
37
  # Install serve globally to serve the React app
38
  RUN pip install uvicorn fastapi tqdm wikitextparser pydantic requests beautifulsoup4 && apt-get update && apt-get install -y nodejs npm && npm install -g serve
39
 
40
+ # Install supervisord
41
+ RUN apt-get install -y supervisor
42
+
43
+ # Copy supervisord configuration
44
+ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
45
+
46
  # Copy built frontend from the first stage
47
  COPY --from=frontend-builder /app/frontend/build /app/frontend/build
48
 
 
53
  EXPOSE 7860
54
  EXPOSE 8000
55
 
56
+ # Start supervisord
57
+ CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
frontend/src/components/TokenizerInput/index.jsx CHANGED
@@ -1,6 +1,5 @@
1
  import React, { useState, useEffect } from 'react';
2
  import './styles.css';
3
- import TrainingProgress from '../TrainingProgress';
4
  import VocabularyGrowth from '../VocabularyGrowth';
5
 
6
  const TokenizerInput = () => {
@@ -28,7 +27,7 @@ const TokenizerInput = () => {
28
  setError(null);
29
  setSelectedToken(null);
30
 
31
- const response = await fetch('http://localhost:8000/tokenize', {
32
  method: 'POST',
33
  headers: {
34
  'Content-Type': 'application/json',
@@ -97,7 +96,6 @@ const TokenizerInput = () => {
97
  return (
98
  <div className="app-container">
99
  <div className="training-section">
100
- <TrainingProgress />
101
  {trainingStats && trainingStats.vocab_growth && (
102
  <VocabularyGrowth vocabGrowth={trainingStats.vocab_growth} />
103
  )}
 
1
  import React, { useState, useEffect } from 'react';
2
  import './styles.css';
 
3
  import VocabularyGrowth from '../VocabularyGrowth';
4
 
5
  const TokenizerInput = () => {
 
27
  setError(null);
28
  setSelectedToken(null);
29
 
30
+ const response = await fetch('http://0.0.0.0:8000/tokenize', {
31
  method: 'POST',
32
  headers: {
33
  'Content-Type': 'application/json',
 
96
  return (
97
  <div className="app-container">
98
  <div className="training-section">
 
99
  {trainingStats && trainingStats.vocab_growth && (
100
  <VocabularyGrowth vocabGrowth={trainingStats.vocab_growth} />
101
  )}
supervisord.conf ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [supervisord]
2
+ nodaemon=true
3
+
4
+ [program:fastapi]
5
+ command=uvicorn main:app --host 0.0.0.0 --port 8000
6
+ directory=/app/backend
7
+ autostart=true
8
+ autorestart=true
9
+
10
+ [program:react]
11
+ command=serve -s /app/frontend/build -l 7860
12
+ directory=/app/frontend/build
13
+ autostart=true
14
+ autorestart=true