add_torch_in_requirementstxt

#4
by psv901 - opened
app-memora.py DELETED
@@ -1,169 +0,0 @@
1
- from pathlib import Path
2
-
3
- import streamlit as st
4
- from googlesearch import search
5
- import pandas as pd
6
- import os
7
- from rag_sec.document_search_system import DocumentSearchSystem
8
- from chainguard.blockchain_logger import BlockchainLogger
9
- from PIL import Image
10
- from itertools import cycle
11
-
12
- # Blockchain Logger
13
- blockchain_logger = BlockchainLogger()
14
-
15
- # Directory for storing uploaded files
16
- UPLOAD_DIR = "uploaded_files"
17
- os.makedirs(UPLOAD_DIR, exist_ok=True)
18
-
19
- # Initialize DocumentSearchSystem
20
- @st.cache_resource
21
- def initialize_system():
22
- """Initialize the DocumentSearchSystem and load documents."""
23
- system = DocumentSearchSystem(
24
- neo4j_uri="neo4j+s://0ca71b10.databases.neo4j.io",
25
- neo4j_user="neo4j",
26
- neo4j_password=""
27
- )
28
- system.retriever.load_documents()
29
- return system
30
-
31
- # Initialize the system
32
- system = initialize_system()
33
-
34
- st.title("Memora: Secure File Upload and Search with Blockchain & Neo4j")
35
- st.subheader("Personalized news and global updates at your fingertips")
36
- # File Upload Section
37
- uploaded_files = st.file_uploader("Upload your files", accept_multiple_files=True, type=['jpg', 'jpeg', 'png', 'mp4', 'avi'])
38
-
39
- if uploaded_files:
40
- for uploaded_file in uploaded_files:
41
- # Save file locally
42
- file_path = os.path.join(UPLOAD_DIR, uploaded_file.name)
43
- with open(file_path, "wb") as f:
44
- f.write(uploaded_file.getbuffer())
45
- st.success(f"File saved locally: {file_path}")
46
-
47
- # Display uploaded file details
48
- if uploaded_file.type.startswith('image'):
49
- image = Image.open(uploaded_file)
50
- st.image(image, caption=uploaded_file.name, use_column_width=True)
51
-
52
- # Metadata Input
53
- album = st.text_input(f"Album for {uploaded_file.name}", "Default Album")
54
- tags = st.text_input(f"Tags for {uploaded_file.name} (comma-separated)", "")
55
-
56
- # Log Metadata and Transaction
57
- if st.button(f"Log Metadata for {uploaded_file.name}"):
58
- metadata = {"file_name": uploaded_file.name, "tags": tags.split(','), "album": album}
59
- blockchain_details = blockchain_logger.log_data(metadata)
60
- blockchain_hash = blockchain_details.get("block_hash", "N/A")
61
-
62
- # Use Neo4jHandler from DocumentSearchSystem to log the transaction
63
- system.neo4j_handler.log_relationships(uploaded_file.name, tags, blockchain_hash, [album])
64
- st.write(f"Metadata logged successfully! Blockchain Details: {blockchain_details}")
65
-
66
- # Blockchain Integrity Validation
67
- if st.button("Validate Blockchain Integrity"):
68
- is_valid = blockchain_logger.is_blockchain_valid()
69
- st.write("Blockchain Integrity:", "Valid ✅" if is_valid else "Invalid ❌")
70
-
71
- # Document Search Section
72
- st.subheader("Search Documents")
73
-
74
- # Google Search: User-Specific News
75
- st.subheader("1. Latest News About You")
76
- user_name = st.text_input("Enter your name or handle to search for recent news", value="Talex Maxim")
77
-
78
- if st.button("Search News About Me"):
79
- if user_name:
80
- st.write(f"Searching Google for news about **{user_name}**...")
81
- try:
82
- results = list(search(user_name, num_results=5))
83
- if results:
84
- st.success(f"Top {len(results)} results for '{user_name}':")
85
- user_news_data = {"URL": results}
86
- df_user_news = pd.DataFrame(user_news_data)
87
- st.dataframe(df_user_news)
88
- except Exception as e:
89
- st.error(f"An error occurred during the search: {str(e)}")
90
- else:
91
- st.warning("Please enter your name or handle to search.")
92
-
93
- # Google Search: Global News Categories
94
- categories = ["Technology", "Sports", "Politics", "Entertainment", "Science"]
95
-
96
- st.title("Global News Insights")
97
-
98
- # News Results Dictionary
99
- news_results = {}
100
-
101
- try:
102
- # Fetch News for Each Category
103
- for category in categories:
104
- try:
105
- news_results[category] = list(search(f"latest {category} news", num_results=3))
106
- except Exception as e:
107
- news_results[category] = [f"Error fetching news: {str(e)}"]
108
-
109
- # Display Results with Styled Buttons
110
- for category, articles in news_results.items():
111
- st.subheader(f"{category} News")
112
- cols = st.columns(3) # Create 3 columns for the layout
113
-
114
- if articles and "Error fetching news" not in articles[0]:
115
- for idx, article in enumerate(articles):
116
- with cols[idx % 3]: # Cycle through columns
117
- st.markdown(
118
- f"""
119
- <div style="padding: 10px; border: 1px solid #ccc; border-radius: 5px; margin: 10px; text-align: center;">
120
- <a href="{article}" target="_blank" style="text-decoration: none;">
121
- <button style="background-color: #c4ccc8; color: white; border: none; padding: 10px 20px; text-align: center; display: inline-block; font-size: 16px; border-radius: 5px;">
122
- {category}-{idx + 1}
123
- </button>
124
- </a>
125
- </div>
126
- """,
127
- unsafe_allow_html=True,
128
- )
129
- else:
130
- st.warning(f"Could not fetch news for **{category}**.")
131
- except Exception as e:
132
- st.error(f"An unexpected error occurred: {str(e)}")
133
-
134
-
135
- # # Display results
136
- # for category, articles in news_results.items():
137
- # st.write(f"### Top News in {category}:")
138
- # for idx, article in enumerate(articles, start=1):
139
- # st.write(f"{idx}. [Read here]({article})")
140
- # except Exception as e:
141
- # st.error(f"An error occurred while fetching global news: {str(e)}")
142
-
143
- # Document Search
144
- st.subheader("3. Search Documents")
145
- query = st.text_input("Enter your query (e.g., 'sports news', 'machine learning')")
146
-
147
- if st.button("Search Documents"):
148
- if query:
149
- result = system.process_query(query)
150
- if result["status"] == "success":
151
- st.success(f"Query processed successfully!")
152
- st.write("### Query Response:")
153
- st.write(result["response"])
154
- st.write("### Retrieved Documents:")
155
- for idx, doc in enumerate(result["retrieved_documents"], start=1):
156
- st.write(f"**Document {idx}:**")
157
- st.write(doc[:500]) # Display the first 500 characters
158
- st.write("### Blockchain Details:")
159
- st.json(result["blockchain_details"])
160
- elif result["status"] == "no_results":
161
- st.warning("No relevant documents found for your query.")
162
- elif result["status"] == "rejected":
163
- st.error(result["message"])
164
- else:
165
- st.warning("Please enter a query to search.")
166
-
167
- # Debugging Section
168
- if st.checkbox("Show Debug Information"):
169
- st.write(f"Total documents loaded: {len(system.retriever.documents)}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app-news-content.py DELETED
@@ -1,105 +0,0 @@
1
- import streamlit as st
2
- import requests
3
- from transformers import T5Tokenizer, T5ForConditionalGeneration
4
- from collections import OrderedDict
5
-
6
- # Load Models
7
- @st.cache_resource
8
- def load_models():
9
- tokenizer = T5Tokenizer.from_pretrained("t5-small")
10
- model = T5ForConditionalGeneration.from_pretrained("t5-small")
11
- return tokenizer, model
12
-
13
- t5_tokenizer, t5_model = load_models()
14
-
15
- # API Key for NewsAPI
16
- NEWS_API_KEY = "66db8e116ae24c49beef53e8b879600a"
17
-
18
- # Fetch news articles based on the user query
19
- @st.cache_data
20
- def fetch_news(user_query):
21
- NEWS_API_URL = "https://newsapi.org/v2/everything"
22
- params = {
23
- 'q': user_query,
24
- 'apiKey': NEWS_API_KEY,
25
- 'language': 'en',
26
- 'pageSize': 10, # Fetch 10 articles
27
- 'sortBy': 'relevance',
28
- }
29
- response = requests.get(NEWS_API_URL, params=params)
30
- if response.status_code == 200:
31
- articles = response.json().get('articles', [])
32
- return [
33
- {
34
- 'title': article.get('title', 'No Title'),
35
- 'description': article.get('description', 'No Description')
36
- }
37
- for article in articles if article.get('description')
38
- ]
39
- return []
40
-
41
- # Summarize articles
42
- def summarize_articles(articles):
43
- summaries = []
44
- for article in articles:
45
- input_text = f"summarize: Title: {article['title']}. Description: {article['description']}"
46
- inputs = t5_tokenizer.encode(input_text, return_tensors="pt", max_length=512, truncation=True)
47
- outputs = t5_model.generate(inputs, max_length=100, min_length=50, length_penalty=2.0, num_beams=4, early_stopping=True)
48
- summary = t5_tokenizer.decode(outputs[0], skip_special_tokens=True)
49
- summaries.append(remove_redundancy(summary))
50
- return summaries
51
-
52
- # Remove redundancy in summaries
53
- def remove_redundancy(summary):
54
- sentences = summary.split('. ')
55
- seen = OrderedDict()
56
- return '. '.join([seen.setdefault(s, s) for s in sentences if s not in seen])
57
-
58
- # Generate catchy content based on all 10 summaries
59
- def generate_catchy_content(summarized_content):
60
- combined_prompt = f"""
61
- Write a blog post based on these insights:
62
- {', '.join(summarized_content)}
63
- """
64
- inputs = t5_tokenizer.encode(combined_prompt, return_tensors="pt", max_length=512, truncation=True)
65
- outputs = t5_model.generate(inputs, max_length=300, length_penalty=2.0, num_beams=4, early_stopping=True)
66
- return t5_tokenizer.decode(outputs[0], skip_special_tokens=True)
67
-
68
- # Main App
69
- st.title("News Summarizer & Blog Generator")
70
- st.subheader("Enter a topic to fetch news, summarize and generate engaging content!")
71
-
72
- # Query Input
73
- user_query = st.text_input("Enter a query (e.g., 'AI trends', 'Climate change impact'):")
74
-
75
- if st.button("Fetch, Summarize and Generate"):
76
- if user_query:
77
- st.info(f"Fetching articles related to: {user_query}")
78
- with st.spinner("Fetching news articles..."):
79
- articles = fetch_news(user_query)
80
- if articles:
81
- st.success(f"Fetched {len(articles)} articles!")
82
-
83
- # Display only the first 4 articles
84
- st.subheader("Fetched Articles")
85
- for i, article in enumerate(articles[:4], 1):
86
- st.write(f"**Article {i}:** {article['title']}")
87
- st.write(f"*Description:* {article['description']}")
88
-
89
- # Summarize All Articles
90
- st.info("Summarizing articles...")
91
- summaries = summarize_articles(articles) # Summarize all 10 articles
92
- st.subheader("Summarized Articles")
93
- for i, summary in enumerate(summaries[:4], 1): # Display summaries for first 4 articles
94
- st.write(f"**Summary {i}:** {summary}")
95
-
96
- # Generate Blog Post
97
- st.info("Generating blog post...")
98
- generated_content = generate_catchy_content(summaries) # Use all 10 summaries
99
- st.subheader("Generated Blog Post")
100
- st.write(generated_content)
101
-
102
- else:
103
- st.warning("No articles found. Try a different query.")
104
- else:
105
- st.error("Please enter a query to proceed!")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app.py CHANGED
@@ -1,28 +1,143 @@
 
 
1
  import streamlit as st
2
- import importlib.util
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
- # Define the paths to the other apps
5
- FIRST_APP_PATH = "app-memora.py"
6
- SECOND_APP_PATH = "app-news-content.py"
 
7
 
8
- def run_script(script_path):
9
- """
10
- Dynamically load and execute a Python script's main() function.
11
- """
12
- # Load the module from the script path
13
- spec = importlib.util.spec_from_file_location("module.name", script_path)
14
- module = importlib.util.module_from_spec(spec)
15
- spec.loader.exec_module(module)
 
16
 
17
- def main():
18
- st.sidebar.title("Navigation")
19
- app_choice = st.sidebar.radio("Choose an App:", ["Memora", "Dynamic News Summarizer"])
 
 
 
 
20
 
21
- if app_choice == "Memora":
22
- run_script(FIRST_APP_PATH)
23
- elif app_choice == "Dynamic News Summarizer":
24
- run_script(SECOND_APP_PATH)
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
- if __name__ == "__main__":
28
- main()
 
 
1
+ from pathlib import Path
2
+
3
  import streamlit as st
4
+ from googlesearch import search
5
+ import pandas as pd
6
+ import os
7
+ from rag_sec.document_search_system import DocumentSearchSystem
8
+ from chainguard.blockchain_logger import BlockchainLogger
9
+ from PIL import Image
10
+
11
+ # Blockchain Logger
12
+ blockchain_logger = BlockchainLogger()
13
+
14
+ # Directory for storing uploaded files
15
+ UPLOAD_DIR = "uploaded_files"
16
+ os.makedirs(UPLOAD_DIR, exist_ok=True)
17
+
18
+ # Initialize DocumentSearchSystem
19
+ @st.cache_resource
20
+ def initialize_system():
21
+ """Initialize the DocumentSearchSystem and load documents."""
22
+ system = DocumentSearchSystem(
23
+ neo4j_uri="neo4j+s://0ca71b10.databases.neo4j.io",
24
+ neo4j_user="neo4j",
25
+ neo4j_password="HwGDOxyGS1-79nLeTiX5bx5ohoFSpvHCmTv8IRgt-lY"
26
+ )
27
+ system.retriever.load_documents()
28
+ return system
29
+
30
+ # Initialize the system
31
+ system = initialize_system()
32
+
33
+ st.title("Memora: Secure File Upload and Search with Blockchain & Neo4j")
34
+ st.subheader("Personalized news and global updates at your fingertips")
35
+ # File Upload Section
36
+ uploaded_files = st.file_uploader("Upload your files", accept_multiple_files=True, type=['jpg', 'jpeg', 'png', 'mp4', 'avi'])
37
+
38
+ if uploaded_files:
39
+ for uploaded_file in uploaded_files:
40
+ # Save file locally
41
+ file_path = os.path.join(UPLOAD_DIR, uploaded_file.name)
42
+ with open(file_path, "wb") as f:
43
+ f.write(uploaded_file.getbuffer())
44
+ st.success(f"File saved locally: {file_path}")
45
+
46
+ # Display uploaded file details
47
+ if uploaded_file.type.startswith('image'):
48
+ image = Image.open(uploaded_file)
49
+ st.image(image, caption=uploaded_file.name, use_column_width=True)
50
+
51
+ # Metadata Input
52
+ album = st.text_input(f"Album for {uploaded_file.name}", "Default Album")
53
+ tags = st.text_input(f"Tags for {uploaded_file.name} (comma-separated)", "")
54
+
55
+ # Log Metadata and Transaction
56
+ if st.button(f"Log Metadata for {uploaded_file.name}"):
57
+ metadata = {"file_name": uploaded_file.name, "tags": tags.split(','), "album": album}
58
+ blockchain_details = blockchain_logger.log_data(metadata)
59
+ blockchain_hash = blockchain_details.get("block_hash", "N/A")
60
+
61
+ # Use Neo4jHandler from DocumentSearchSystem to log the transaction
62
+ system.neo4j_handler.log_relationships(uploaded_file.name, tags, blockchain_hash, [album])
63
+ st.write(f"Metadata logged successfully! Blockchain Details: {blockchain_details}")
64
+
65
+ # Blockchain Integrity Validation
66
+ if st.button("Validate Blockchain Integrity"):
67
+ is_valid = blockchain_logger.is_blockchain_valid()
68
+ st.write("Blockchain Integrity:", "Valid ✅" if is_valid else "Invalid ❌")
69
+
70
+ # Document Search Section
71
+ st.subheader("Search Documents")
72
+
73
+ # Google Search: User-Specific News
74
+ st.subheader("1. Latest News About You")
75
+ user_name = st.text_input("Enter your name or handle to search for recent news", value="Talex Maxim")
76
+
77
+ if st.button("Search News About Me"):
78
+ if user_name:
79
+ st.write(f"Searching Google for news about **{user_name}**...")
80
+ try:
81
+ results = list(search(user_name, num_results=5))
82
+ if results:
83
+ st.success(f"Top {len(results)} results for '{user_name}':")
84
+ user_news_data = {"URL": results}
85
+ df_user_news = pd.DataFrame(user_news_data)
86
+ st.dataframe(df_user_news)
87
+ else:
88
+ st.warning("No recent news found about you.")
89
+ except Exception as e:
90
+ st.error(f"An error occurred during the search: {str(e)}")
91
+ else:
92
+ st.warning("Please enter your name or handle to search.")
93
 
94
+ # Google Search: Global News Categories
95
+ st.subheader("2. Global News Insights")
96
+ categories = ["Technology", "Sports", "Politics", "Entertainment", "Science"]
97
+ news_results = {}
98
 
99
+ if st.button("Fetch Global News"):
100
+ try:
101
+ for category in categories:
102
+ st.write(f"Fetching news for **{category}**...")
103
+ try:
104
+ category_results = list(search(f"latest {category} news", num_results=3))
105
+ news_results[category] = category_results
106
+ except Exception as e:
107
+ news_results[category] = [f"Error fetching news: {str(e)}"]
108
 
109
+ # Display results
110
+ for category, articles in news_results.items():
111
+ st.write(f"### Top News in {category}:")
112
+ for idx, article in enumerate(articles, start=1):
113
+ st.write(f"{idx}. [Read here]({article})")
114
+ except Exception as e:
115
+ st.error(f"An error occurred while fetching global news: {str(e)}")
116
 
117
+ # Document Search
118
+ st.subheader("3. Search Documents")
119
+ query = st.text_input("Enter your query (e.g., 'sports news', 'machine learning')")
 
120
 
121
+ if st.button("Search Documents"):
122
+ if query:
123
+ result = system.process_query(query)
124
+ if result["status"] == "success":
125
+ st.success(f"Query processed successfully!")
126
+ st.write("### Query Response:")
127
+ st.write(result["response"])
128
+ st.write("### Retrieved Documents:")
129
+ for idx, doc in enumerate(result["retrieved_documents"], start=1):
130
+ st.write(f"**Document {idx}:**")
131
+ st.write(doc[:500]) # Display the first 500 characters
132
+ st.write("### Blockchain Details:")
133
+ st.json(result["blockchain_details"])
134
+ elif result["status"] == "no_results":
135
+ st.warning("No relevant documents found for your query.")
136
+ elif result["status"] == "rejected":
137
+ st.error(result["message"])
138
+ else:
139
+ st.warning("Please enter a query to search.")
140
 
141
+ # Debugging Section
142
+ if st.checkbox("Show Debug Information"):
143
+ st.write(f"Total documents loaded: {len(system.retriever.documents)}")
devops_ai/__init__.py DELETED
File without changes
devops_ai/deployment_script.py DELETED
@@ -1,60 +0,0 @@
1
- import os
2
- import json
3
- from openai import OpenAI
4
-
5
- def generate_helm_chart():
6
- client = OpenAI(
7
- base_url="https://api.studio.nebius.ai/v1/",
8
- api_key="N_KEY"
9
- )
10
- prompt = """
11
- pipeline {
12
- agent any
13
- stages {
14
- stage('Build') {
15
- steps {
16
- echo 'Building...'
17
- sh './gradlew build'
18
- }
19
- }
20
- stage('Test') {
21
- steps {
22
- echo 'Testing...'
23
- sh './gradlew test'
24
- }
25
- }
26
- stage('Deploy') {
27
- steps {
28
- echo 'Deploying...'
29
- sh './deploy.sh'
30
- }
31
- }
32
- }
33
- }
34
- """
35
- response = client.chat.completions.create(
36
- model="Qwen/Qwen2-VL-72B-Instruct",
37
- messages=[
38
- {
39
- "role": "user",
40
- "content": [
41
- {"type": "text",
42
- "text": f"Convert this Jenkinsfile into a GitHub Actions workflow:\n\n{prompt}"}
43
- ],
44
- }
45
- ],
46
- max_tokens=300,
47
- )
48
-
49
- # Extracting and prettifying the content
50
- if response.choices:
51
- helm_chart_raw = response.choices[0].message.content
52
-
53
- # Prettifying the output
54
- print("\n--- Helm Chart Output (Prettified) ---\n")
55
- print(helm_chart_raw.strip())
56
- else:
57
- print("No response received from the API.")
58
-
59
- if __name__ == "__main__":
60
- generate_helm_chart()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
devops_ai/example-service_helm_chart.yaml DELETED
@@ -1,26 +0,0 @@
1
- Here's an example of how you can deploy an AWS Lambda function using CloudFormation. This Lambda function will be triggered when an object is created in a specified S3 bucket, and it will convert all uploaded files to PDF format:
2
- 1. **Template Preparation:**
3
- - Create a new directory on your local machine where you will store the template file and Lambda function code.
4
- - Write a Python code for the Lambda function that converts files to PDF. Here's a simple example using the `python-pdf` library:
5
- ```python
6
- import boto3
7
- import pdfkit
8
- s3 = boto3.client('s3')
9
-
10
- def convert_to_pdf(event, context):
11
- # Extract file name and bucket name from the event
12
- bucket_name = event['Records'][0]['s3']['bucket']['name']
13
- file_name = event['Records'][0]['s3']['object']['key']
14
-
15
- # Download the file from S3
16
- response = s3.get_object(Bucket=bucket_name, Key=file_name)
17
- original_file_data = response['Body'].read()
18
-
19
- # Convert the file to PDF
20
- pdf_file = pdfkit.from_string(original_file_data)
21
- pdf_filename = file_name + '.pdf'
22
-
23
- # Upload the PDF back to S3
24
- upload_response = s3.put_object(
25
- Body=pdf_file,
26
- Bucket=
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
devops_ai/helm_chart_generator.py DELETED
@@ -1,45 +0,0 @@
1
-
2
-
3
- import cohere
4
-
5
- # Initialize Cohere client
6
- co = cohere.Client("nvnj")
7
-
8
- def generate_helm_chart(prompt):
9
- prompt = f"Generate a Kubernetes Helm chart for a microservice named '{service_name}' in YAML format."
10
- response = co.generate(
11
- model="command",
12
- prompt=prompt,
13
- max_tokens=300,
14
- temperature=0.7,
15
- )
16
- return response.generations[0].text.strip()
17
-
18
- # Example Usage
19
- service_name = "example-service"
20
- helm_chart = generate_helm_chart(service_name)
21
- print(helm_chart)
22
-
23
-
24
- def save_exact_output_to_file(output, file_name):
25
- try:
26
- # Save the exact string output to the file
27
- with open(file_name, "w") as file:
28
- file.write(output)
29
- print(f"Output saved successfully to {file_name}")
30
- except Exception as e:
31
- print(f"Error saving output: {e}")
32
-
33
-
34
- # Example Usage
35
- if __name__ == "__main__":
36
- service_name = "example-service"
37
- try:
38
- # Generate the Helm chart
39
- helm_chart = generate_helm_chart(service_name)
40
-
41
- # Save the output to a YAML file
42
- file_name = f"{service_name}_helm_chart.yaml"
43
- save_exact_output_to_file(helm_chart, file_name)
44
- except Exception as e:
45
- print(f"Error: {e}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rag_sec/document_search_system.py CHANGED
@@ -155,10 +155,7 @@ class DocumentSearchSystem:
155
  blockchain_details = self.data_transformer.secure_transform({"type": "response", "content": response})
156
 
157
  # Log relationships to Neo4j
158
- try:
159
- self.neo4j_handler.log_relationships(query, transformed_query, response, retrieved_docs)
160
- except Exception as e:
161
- print(e)
162
 
163
  return {
164
  "status": "success",
 
155
  blockchain_details = self.data_transformer.secure_transform({"type": "response", "content": response})
156
 
157
  # Log relationships to Neo4j
158
+ self.neo4j_handler.log_relationships(query, transformed_query, response, retrieved_docs)
 
 
 
159
 
160
  return {
161
  "status": "success",
rag_sec/requirements.txt CHANGED
@@ -5,4 +5,3 @@ scikit-learn
5
  faiss-cpu
6
  pandas
7
  transformers
8
- torch
 
5
  faiss-cpu
6
  pandas
7
  transformers
 
requirements.txt CHANGED
@@ -6,8 +6,4 @@ scikit-learn
6
  faiss-cpu
7
  pandas
8
  transformers
9
- googlesearch-python
10
- torch
11
- requests
12
- pyspellchecker
13
- sentencepiece
 
6
  faiss-cpu
7
  pandas
8
  transformers
9
+ googlesearch-python