Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into Preview-Image
Browse files Browse the repository at this point in the history
  • Loading branch information
ShradhaSaxena23 committed Oct 9, 2024
2 parents c2f7516 + 7c81e0d commit 1635473
Show file tree
Hide file tree
Showing 189 changed files with 191,150 additions and 1,754 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.zip filter=lfs diff=lfs merge=lfs -text
3 changes: 3 additions & 0 deletions AgroTech-ChatBot/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.venv
.idea
venv
2 changes: 2 additions & 0 deletions AgroTech-ChatBot/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
groq==0.9.0
streamlit==1.37.0
1 change: 1 addition & 0 deletions AgroTech-ChatBot/src/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"GROQ_API_KEY": "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"}
38 changes: 38 additions & 0 deletions AgroTech-ChatBot/src/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from flask import Flask, request, jsonify
from flask_cors import CORS
import os
import json
from groq import Groq

app = Flask(__name__)
CORS(app) # Enable CORS for all routes

# Load API key
working_dir = os.path.dirname(os.path.abspath(__file__))
config_data = json.load(open(f"{working_dir}/config.json"))
GROQ_API_KEY = config_data["GROQ_API_KEY"]
os.environ["GROQ_API_KEY"] = GROQ_API_KEY

client = Groq()

@app.route('/AgroTech-ChatBot', methods=['POST'])
def chat():
data = request.json
user_prompt = data.get('prompt')

# Prepare messages for the LLM
messages = [{'role': "system", "content": "You are a helpful assistant"}]
if user_prompt:
messages.append({"role": "user", "content": user_prompt})

# Get response from LLM
response = client.chat.completions.create(
model="llama-3.1-8b-instant",
messages=messages
)
assistant_response = response.choices[0].message.content
return jsonify({"response": assistant_response})
return jsonify({"error": "No prompt provided"}), 400

if __name__ == '__main__':
app.run(port=5000)
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 manikumarreddyu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 21 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Security Policy

## Supported Versions

Use this section to tell people about which versions of your project are
currently being supported with security updates.

| Version | Supported |
| ------- | ------------------ |
| 5.1.x | :white_check_mark: |
| 5.0.x | :x: |
| 4.0.x | :white_check_mark: |
| < 4.0 | :x: |

## Reporting a Vulnerability

Use this section to tell people how to report a vulnerability.

Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.
Loading

0 comments on commit 1635473

Please sign in to comment.