w831152001 commited on
Commit
fa8c90c
·
1 Parent(s): f5abcaf
Files changed (2) hide show
  1. Dockerfile +1 -1
  2. main.py +3 -3
Dockerfile CHANGED
@@ -8,4 +8,4 @@ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
8
 
9
  COPY . .
10
 
11
- CMD ["gunicorn","-b", "0.0.0.0:7860", "main:app"]
 
8
 
9
  COPY . .
10
 
11
+ CMD ["gunicorn","-b", "0.0.0.0:7860", "main:app"]
main.py CHANGED
@@ -31,8 +31,8 @@ headers = {"Authorization": f"Bearer {HF_TOKEN}"}
31
  API_URL = "https://api-inference.huggingface.co/models/mistralai/Mixtral-8x7B-Instruct-v0.1"
32
  def query(payload):
33
  response = requests.post(API_URL, headers=headers, json=payload)
34
- app.logger.info("-------"+response.text)
35
- return json.loads(response)
36
 
37
  app = Flask(__name__)
38
 
@@ -73,7 +73,7 @@ def callback():
73
  def handle_message(event):
74
  with ApiClient(configuration) as api_client:
75
  line_bot_api = MessagingApi(api_client)
76
- response = query(event.message.text)
77
  html_msg = markdown.markdown(response)
78
  soup = BeautifulSoup(html_msg, 'html.parser')
79
  line_bot_api.reply_message(
 
31
  API_URL = "https://api-inference.huggingface.co/models/mistralai/Mixtral-8x7B-Instruct-v0.1"
32
  def query(payload):
33
  response = requests.post(API_URL, headers=headers, json=payload)
34
+ app.logger.info("-----"+response.text)
35
+ return response.json()
36
 
37
  app = Flask(__name__)
38
 
 
73
  def handle_message(event):
74
  with ApiClient(configuration) as api_client:
75
  line_bot_api = MessagingApi(api_client)
76
+ response = query({"inputs": event.message.text})
77
  html_msg = markdown.markdown(response)
78
  soup = BeautifulSoup(html_msg, 'html.parser')
79
  line_bot_api.reply_message(