ayushsinghal1510 commited on
Commit
85bb529
·
1 Parent(s): 23dcc1c
Files changed (2) hide show
  1. Dockerfile +5 -3
  2. app.py +13 -11
Dockerfile CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  FROM python:3.9
2
 
3
  RUN useradd -m -u 1000 user
@@ -7,8 +10,7 @@ ENV PATH="/home/user/.local/bin:$PATH"
7
  WORKDIR /app
8
 
9
  COPY --chown=user ./requirements.txt requirements.txt
10
- COPY . .
11
- RUN sudo chmod +x ./start.sh
12
 
13
  COPY --chown=user . /app
14
- CMD ["./start.sh"]
 
1
+ # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
+ # you will also find guides on how best to write your Dockerfile
3
+
4
  FROM python:3.9
5
 
6
  RUN useradd -m -u 1000 user
 
10
  WORKDIR /app
11
 
12
  COPY --chown=user ./requirements.txt requirements.txt
13
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
 
14
 
15
  COPY --chown=user . /app
16
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
app.py CHANGED
@@ -5,9 +5,9 @@ from groq import Groq
5
  import os
6
  from dotenv import load_dotenv
7
  from tqdm import tqdm
8
- from redis import Redis
9
  from fastapi.staticfiles import StaticFiles
10
- from fastapi.responses import FileResponse
11
  from fastapi.templating import Jinja2Templates
12
 
13
  import uvicorn
@@ -16,17 +16,19 @@ from scripts.services.services import run_pandas_script
16
 
17
  load_dotenv()
18
 
19
- redis_client: Redis = Redis(
20
- host='localhost',
21
- port=6379,
22
- decode_responses=True
23
- )
 
 
24
 
25
- keys = redis_client.keys()
26
 
27
- if keys:
28
- for key in tqdm(keys, total=len(keys), desc='Cleaning Redis'):
29
- redis_client.delete(key)
30
 
31
  with open('assets/prompts/ask_pandas.md') as ask_pandas_file:
32
  ask_pandas_system_prompt : str = ask_pandas_file.read()
 
5
  import os
6
  from dotenv import load_dotenv
7
  from tqdm import tqdm
8
+ # from redis import Redis
9
  from fastapi.staticfiles import StaticFiles
10
+ # from fastapi.responses import FileResponse
11
  from fastapi.templating import Jinja2Templates
12
 
13
  import uvicorn
 
16
 
17
  load_dotenv()
18
 
19
+ # redis_client: Redis = Redis(
20
+ # host='localhost',
21
+ # port=6379,
22
+ # decode_responses=True
23
+ # )
24
+
25
+ redis_client = ''
26
 
27
+ # keys = redis_client.keys()
28
 
29
+ # if keys:
30
+ # for key in tqdm(keys, total=len(keys), desc='Cleaning Redis'):
31
+ # redis_client.delete(key)
32
 
33
  with open('assets/prompts/ask_pandas.md') as ask_pandas_file:
34
  ask_pandas_system_prompt : str = ask_pandas_file.read()