Tri4 commited on
Commit
98d78ef
·
verified ·
1 Parent(s): 65a7958
Files changed (1) hide show
  1. main.py +24 -0
main.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, request
2
+ from twilio.twiml.messaging_response import MessagingResponse
3
+
4
+ sms_chain = LLMChain(
5
+ llm=Baseten(model="YOUR-MODEL-VERSION-ID"),
6
+ prompt=prompt,
7
+ memory=ConversationBufferWindowMemory(k=2),
8
+ llm_kwargs={"max_length": 4096}
9
+ )
10
+
11
+ app = Flask(__name__)
12
+
13
+
14
+ @app.route("/sms", methods=['GET', 'POST'])
15
+ def sms():
16
+ resp = MessagingResponse()
17
+ inb_msg = request.form['Body'].lower().strip()
18
+ output = sms_chain.predict(sms_input=inb_msg)
19
+ print(output)
20
+ resp.message(output)
21
+ return str(resp)
22
+
23
+ if __name__ == "__main__":
24
+ app.run(debug=True)