Spaces:
Sleeping
Sleeping
Delete yep_mistral_flask.py
Browse files- yep_mistral_flask.py +0 -47
yep_mistral_flask.py
DELETED
|
@@ -1,47 +0,0 @@
|
|
| 1 |
-
from flask import Flask, request, jsonify
|
| 2 |
-
import mistral_8x7b_yepchat
|
| 3 |
-
|
| 4 |
-
app = Flask(__name__)
|
| 5 |
-
|
| 6 |
-
@app.route('/chat', methods=['GET'])
|
| 7 |
-
def chat():
|
| 8 |
-
|
| 9 |
-
query = request.args.get('query') # Assuming the query is sent in JSON format
|
| 10 |
-
max_tokens = int(request.args.get('max_tokens', 300))
|
| 11 |
-
temperature = float(request.args.get('temperature', 0.7)) # Optional parameter with default value
|
| 12 |
-
|
| 13 |
-
# Developer information
|
| 14 |
-
developer_info = {
|
| 15 |
-
'developer': 'Devs Do Code',
|
| 16 |
-
'contact': {
|
| 17 |
-
'Telegram': 'https://t.me/devsdocode',
|
| 18 |
-
'YouTube Channel': 'https://www.youtube.com/@DevsDoCode',
|
| 19 |
-
'Discord Server': 'https://discord.gg/ehwfVtsAts',
|
| 20 |
-
'Instagram': {
|
| 21 |
-
'Personal': 'https://www.instagram.com/sree.shades_/',
|
| 22 |
-
'Channel': 'https://www.instagram.com/devsdocode_/'
|
| 23 |
-
}
|
| 24 |
-
}
|
| 25 |
-
}
|
| 26 |
-
|
| 27 |
-
if query:
|
| 28 |
-
response = mistral_8x7b_yepchat.Mistral_Inference(max_tokens=max_tokens, temperature=temperature).chat(query)
|
| 29 |
-
return jsonify([{'response': response}, {'developer_info': developer_info}])
|
| 30 |
-
|
| 31 |
-
else:
|
| 32 |
-
error_message = {
|
| 33 |
-
'developer_contact': {
|
| 34 |
-
'telegram': 'https://t.me/DevsDoCode',
|
| 35 |
-
'instagram': 'https://www.instagram.com/sree.shades_/',
|
| 36 |
-
'discord': 'https://discord.gg/ehwfVtsAts',
|
| 37 |
-
'linkedin': 'https://www.linkedin.com/in/developer-sreejan/',
|
| 38 |
-
'twitter': 'https://twitter.com/Anand_Sreejan'
|
| 39 |
-
},
|
| 40 |
-
'error': 'Oops! Something went wrong. Please contact the developer Devs Do Code.'
|
| 41 |
-
}
|
| 42 |
-
return jsonify(error_message), 400
|
| 43 |
-
|
| 44 |
-
if __name__ == '__main__':
|
| 45 |
-
app.run(debug=True)
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|