Oleg Lavrovsky commited on
Commit
98cad23
·
unverified ·
1 Parent(s): 1303c4e
Files changed (2) hide show
  1. README.md +10 -1
  2. app.py +6 -1
README.md CHANGED
@@ -18,6 +18,15 @@ Apertus transformer on FastAPI
18
 
19
  A FastAPI-based Python application that provides an API to interface with the Apertus LLM from the Swiss AI Initiative.
20
 
 
 
21
  ## TODOs
22
 
23
- - Implement the Apertus Format API https://github.com/swiss-ai/apertus_format
 
 
 
 
 
 
 
 
18
 
19
  A FastAPI-based Python application that provides an API to interface with the Apertus LLM from the Swiss AI Initiative.
20
 
21
+ For more information go to https://huggingface.co/swiss-ai
22
+
23
  ## TODOs
24
 
25
+ - [Apertus Format API](https://github.com/swiss-ai/apertus_format)
26
+ - [OpenAI-compatible API](https://medium.com/data-science/how-to-build-an-openai-compatible-api-87c8edea2f06)
27
+ - ...?
28
+ - Profit!
29
+
30
+ Just kidding, this is an open source project under the [European Public Domain License](LICENSE)
31
+
32
+ If you have further suggestions please leave them on [Codeberg Issues](https://codeberg.org/loleg/fastapi-apertus/issues)
app.py CHANGED
@@ -7,6 +7,8 @@ from torch import cuda
7
  from transformers import AutoModelForCausalLM, AutoTokenizer
8
 
9
  from huggingface_hub import login
 
 
10
 
11
  import logging
12
  # Configure logging
@@ -14,7 +16,10 @@ logging.basicConfig(level=logging.INFO)
14
  logger = logging.getLogger(__name__)
15
 
16
  # Required for access to a gated model
17
- login()
 
 
 
18
 
19
  # Keep data in session
20
  model = None
 
7
  from transformers import AutoModelForCausalLM, AutoTokenizer
8
 
9
  from huggingface_hub import login
10
+ from dotenv import load_dotenv
11
+ import os
12
 
13
  import logging
14
  # Configure logging
 
16
  logger = logging.getLogger(__name__)
17
 
18
  # Required for access to a gated model
19
+ load_dotenv()
20
+ hf_token = os.getenv("HUGGING_FACE_TOKEN", None)
21
+ if hf_token is not None:
22
+ login(token=hf_token)
23
 
24
  # Keep data in session
25
  model = None