22 lines
552 B
Python
22 lines
552 B
Python
# Example function to interact with OLLAMA
|
|
from ollama import Client
|
|
|
|
def get_response(user_query):
|
|
client = Client()
|
|
response = client.generate_response(user_query)
|
|
return response
|
|
|
|
# Flask endpoint for user interaction
|
|
from flask import Flask, request, jsonify
|
|
app = Flask(__name__)
|
|
|
|
@app.route('/smartassist', methods=['POST'])
|
|
def smartassist():
|
|
data = request.json
|
|
user_query = data['query']
|
|
response = get_response(user_query)
|
|
return jsonify({"response": response})
|
|
|
|
if __name__ == '__main__':
|
|
app.run(debug=True)
|