Update main.py
Browse files
main.py
CHANGED
|
@@ -1,6 +1,4 @@
|
|
| 1 |
from flask import Flask, request, abort
|
| 2 |
-
from flask_ngrok import run_with_ngrok # colab
|
| 3 |
-
from llama_cpp import Llama
|
| 4 |
import json
|
| 5 |
import os
|
| 6 |
|
|
@@ -21,7 +19,6 @@ working_status = os.getenv("DEFALUT_TALKING", default = "true").lower() == "true
|
|
| 21 |
|
| 22 |
app = Flask(__name__)
|
| 23 |
|
| 24 |
-
llm = Llama(model_path="Breeze-7B-Instruct-v0.1-Q8_0.gguf", n_gpu_layers=32)
|
| 25 |
line_handler = WebhookHandler(YOUR_CHANNEL_SECRET)
|
| 26 |
line_bot_api = LineBotApi(YOUR_CHANNEL_ACCESS_TOKEN)
|
| 27 |
|
|
@@ -55,9 +52,7 @@ def handle_message(event):
|
|
| 55 |
return
|
| 56 |
|
| 57 |
if working_status:
|
| 58 |
-
|
| 59 |
-
out = llm(QA, max_tokens=512, temperature = 0.5, echo=True)
|
| 60 |
-
out = out['choices'][0]['text'].split('ASSISTANT:')[1]
|
| 61 |
if not out:
|
| 62 |
out = "不懂您的意思!"
|
| 63 |
line_bot_api.reply_message(
|
|
|
|
| 1 |
from flask import Flask, request, abort
|
|
|
|
|
|
|
| 2 |
import json
|
| 3 |
import os
|
| 4 |
|
|
|
|
| 19 |
|
| 20 |
app = Flask(__name__)
|
| 21 |
|
|
|
|
| 22 |
line_handler = WebhookHandler(YOUR_CHANNEL_SECRET)
|
| 23 |
line_bot_api = LineBotApi(YOUR_CHANNEL_ACCESS_TOKEN)
|
| 24 |
|
|
|
|
| 52 |
return
|
| 53 |
|
| 54 |
if working_status:
|
| 55 |
+
out = event.message.text
|
|
|
|
|
|
|
| 56 |
if not out:
|
| 57 |
out = "不懂您的意思!"
|
| 58 |
line_bot_api.reply_message(
|