AdamNovotnyCom
commited on
Commit
•
ee35c38
1
Parent(s):
238a55c
refactor
Browse files- .gitignore +1 -0
- Dockerfile +1 -2
- app.py +4 -0
.gitignore
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
*.DS_Store
|
|
|
2 |
*.vscode
|
3 |
*.pytest_cache
|
4 |
*.log"
|
|
|
1 |
*.DS_Store
|
2 |
+
*.secrets
|
3 |
*.vscode
|
4 |
*.pytest_cache
|
5 |
*.log"
|
Dockerfile
CHANGED
@@ -21,7 +21,6 @@ RUN pip install -r requirements.txt
|
|
21 |
EXPOSE 7860
|
22 |
|
23 |
RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \
|
24 |
-
cat /run/secrets/HF_TOKEN > /home/user/app/HF_TOKEN
|
25 |
-
ENV HF_TOKEN=$(cat /home/user/app/HF_TOKEN)
|
26 |
|
27 |
CMD ["python", "app.py"]
|
|
|
21 |
EXPOSE 7860
|
22 |
|
23 |
RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \
|
24 |
+
cat /run/secrets/HF_TOKEN > /home/user/app/.secrets/HF_TOKEN
|
|
|
25 |
|
26 |
CMD ["python", "app.py"]
|
app.py
CHANGED
@@ -15,6 +15,10 @@ def google_flan(input_text, request: gr.Request):
|
|
15 |
print(request.query_params)
|
16 |
print(os.environ.get("HF_TOKEN")[:5])
|
17 |
logging.info(os.environ.get("HF_TOKEN")[:5])
|
|
|
|
|
|
|
|
|
18 |
return pipe_flan(input_text)
|
19 |
|
20 |
# model = "meta-llama/Llama-2-7b-chat-hf"
|
|
|
15 |
print(request.query_params)
|
16 |
print(os.environ.get("HF_TOKEN")[:5])
|
17 |
logging.info(os.environ.get("HF_TOKEN")[:5])
|
18 |
+
with open("/home/user/app/.secrets/HF_TOKEN", "r") as f:
|
19 |
+
var = f.readlines()[0].strip()
|
20 |
+
print(var[:5])
|
21 |
+
logging.info(var[:5])
|
22 |
return pipe_flan(input_text)
|
23 |
|
24 |
# model = "meta-llama/Llama-2-7b-chat-hf"
|