hatmanstack commited on
Commit
bd26bae
·
1 Parent(s): cd1b402
Files changed (3) hide show
  1. .gitignore +1 -0
  2. Dockerfile +1 -1
  3. main.py +3 -1
.gitignore CHANGED
@@ -9,6 +9,7 @@ npm-debug.*
9
  *.key
10
  *.mobileprovision
11
  *.orig.*
 
12
 
13
 
14
  # macOS
 
9
  *.key
10
  *.mobileprovision
11
  *.orig.*
12
+ /secrets
13
 
14
 
15
  # macOS
Dockerfile CHANGED
@@ -16,7 +16,7 @@ USER user
16
 
17
  # Set home to the user's home directory
18
  ENV HOME=/home/user \
19
- PATH=/home/user/.local/bin:$PATH
20
 
21
  # Set the working directory to the user's home directory
22
  WORKDIR $HOME/app
 
16
 
17
  # Set home to the user's home directory
18
  ENV HOME=/home/user \
19
+ PATH=/home/user/.local/bin:$PATH
20
 
21
  # Set the working directory to the user's home directory
22
  WORKDIR $HOME/app
main.py CHANGED
@@ -10,6 +10,8 @@ from io import BytesIO
10
 
11
  app = FastAPI()
12
 
 
 
13
  class Item(BaseModel):
14
  prompt: str
15
  steps: int
@@ -32,7 +34,7 @@ async def inference(item: Item):
32
  data = {"inputs":prompt, "options":{"wait_for_model": True, "use_cache": False}}
33
  API_URL = "https://api-inference.huggingface.co/models/" + item.modelID
34
 
35
- headers = {"Authorization": f"Bearer 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"}
36
  api_data = json.dumps(data)
37
  response = requests.request("POST", API_URL, headers=headers, data=api_data)
38
 
 
10
 
11
  app = FastAPI()
12
 
13
+ token = os.environ.get("HF_TOKEN")
14
+
15
  class Item(BaseModel):
16
  prompt: str
17
  steps: int
 
34
  data = {"inputs":prompt, "options":{"wait_for_model": True, "use_cache": False}}
35
  API_URL = "https://api-inference.huggingface.co/models/" + item.modelID
36
 
37
+ headers = {"Authorization": f"Bearer " + token}
38
  api_data = json.dumps(data)
39
  response = requests.request("POST", API_URL, headers=headers, data=api_data)
40