MarkChenX commited on
Commit
eb795ae
·
1 Parent(s): 2348002

update codebase

Browse files
Files changed (3) hide show
  1. Dockerfile +1 -1
  2. ai copy/__init__.py +0 -0
  3. ai copy/chatbot.py +0 -30
Dockerfile CHANGED
@@ -38,6 +38,6 @@ COPY ./requirements.txt /code/requirements.txt
38
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
39
 
40
  # Copy your application source code and script
41
- COPY ./api /app
42
 
43
  CMD ["uvicorn", "app.app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
38
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
39
 
40
  # Copy your application source code and script
41
+ COPY . /app
42
 
43
  CMD ["uvicorn", "app.app.main:app", "--host", "0.0.0.0", "--port", "7860"]
ai copy/__init__.py DELETED
File without changes
ai copy/chatbot.py DELETED
@@ -1,30 +0,0 @@
1
- import os
2
- from openai import OpenAI
3
- import requests
4
-
5
- API_TOKEN = os.getenv("HUGGINGFACE_API_TOKEN")
6
-
7
- API_URL = "https://api-inference.huggingface.co/models/meta-llama/Llama-2-7b-chat-hf"
8
- headers = {"Authorization": f"Bearer {API_TOKEN}"}
9
-
10
- client = OpenAI(
11
- organization=os.getenv("OPENAI_ORG_ID"), api_key=os.getenv("OPENAI_API_KEY")
12
- )
13
-
14
-
15
- def gpt_chatbot(user_request: str):
16
- completion = client.chat.completions.create(
17
- model="gpt-4o-mini",
18
- messages=[
19
- {"role": "system", "content": "You are a helpful assistant."},
20
- {"role": "user", "content": user_request},
21
- ],
22
- )
23
-
24
- return completion.choices[0].message.content
25
-
26
-
27
- def llama_chatbot(user_request: str):
28
- response = requests.post(API_URL, headers=headers, json={"inputs": user_request})
29
-
30
- return response.json()[0]["generated_text"]