acecalisto3 commited on
Commit
e028678
1 Parent(s): cdf8fef

Delete components

Browse files
components/__init__.py DELETED
@@ -1,7 +0,0 @@
1
- # components/__init__.py
2
- from .home import HomePage
3
- from .refactor_page import RefactorPage
4
- from .style_page import StylePage
5
- from .test_page import TestPage
6
- from .optimize_page import OptimizePage
7
- from .documentation_page import DocumentationPage
 
 
 
 
 
 
 
 
components/database_page.py DELETED
@@ -1,18 +0,0 @@
1
- # components/database_page.py
2
- import streamlit as st
3
- import sqlite3
4
-
5
- def show_database_page(chat):
6
- st.title("Database Interaction")
7
- st.write("This page interacts with a SQLite database.")
8
-
9
- def execute_query(query):
10
- conn = sqlite3.connect("test.db")
11
- result = conn.execute(query)
12
- return result.fetchall()
13
-
14
- database_query = st.text_input("Enter the SQLite query:", "SELECT * FROM users;")
15
-
16
- if st.button("Execute Query"):
17
- result = execute_query(database_query)
18
- st.write(result)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
components/documentation_page.py DELETED
@@ -1,22 +0,0 @@
1
- # components/code_documentation_page.py
2
- import streamlit as st
3
- from langchain.prompts.chat import SystemMessagePromptTemplate, HumanMessagePromptTemplate
4
- from langchain.chains import LLMChain
5
- from langchain.llms import OpenAI
6
-
7
- def show_doc_page(chat):
8
- st.title("Code Documentation Generator")
9
- st.write("This page generates documentation for a given code snippet.")
10
-
11
- code_snippet = st.text_area("Enter the code snippet:", height=200)
12
-
13
- if st.button("Generate Documentation"):
14
- # Implement the functionality for generating documentation
15
- system_message_prompt = SystemMessagePromptTemplate.from_template("Generate documentation for the provided code snippet.")
16
- human_message_prompt = HumanMessagePromptTemplate.from_template("Code snippet:\n{code_snippet}")
17
- chat_prompt = SystemMessagePromptTemplate.from_prompt_template(system_message_prompt)
18
- chat_prompt.add_message(human_message_prompt)
19
- llm = OpenAI(temperature=0.5)
20
- chain = LLMChain(llm=llm, prompt=chat_prompt)
21
- result = chain.run(code_snippet=code_snippet)
22
- st.write(result)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
components/home.py DELETED
@@ -1,11 +0,0 @@
1
- import streamlit as st
2
-
3
- def show_home_page():
4
- st.title("Welcome to CodeCraft GPT!")
5
- st.write("This is the home page.")
6
-
7
- st.markdown("""
8
- CodeCraft GPT is an all-in-one platform designed for AI/ML developers.
9
- It offers a set of mini-apps for code documentation, optimization, refactoring,
10
- style checking, testing, language translation, and database interaction.
11
- """)
 
 
 
 
 
 
 
 
 
 
 
 
components/lang_page.py DELETED
@@ -1,14 +0,0 @@
1
- import streamlit as st
2
- from langchain.chat_models import ChatOpenAI
3
-
4
- def show_lang_page(chat):
5
- st.title("Language Translation")
6
- st.write("This page translates code snippets between programming languages.")
7
-
8
- source_language = st.selectbox("Select the source language:", LANGUAGES)
9
- target_language = st.selectbox("Select the target language:", LANGUAGES)
10
- code_snippet = st.text_area("Enter the code snippet:", height=200)
11
-
12
- if st.button("Translate Code"):
13
- # Implement the functionality for translating code
14
- pass
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
components/optimization_page.py DELETED
@@ -1,31 +0,0 @@
1
- # components/code_optimization_page.py
2
- import streamlit as st
3
- from langchain.prompts.chat import (
4
- ChatPromptTemplate,
5
- HumanMessagePromptTemplate,
6
- SystemMessagePromptTemplate)
7
- from langchain.chat_models import ChatOpenAI
8
- from data.optimization_prompt import OPTIMIZATION_PROMPT
9
-
10
- def show_optimize_page(chat):
11
- # Request a code snippet for optimization
12
- st.subheader("Request Code Snippet for Optimization")
13
- user_code = st.text_area("Enter the code snippet:", "def factorial(n):\n\treturn 1 if n < 2 else n * factorial(n - 1)", height=200)
14
-
15
- if st.button("Optimize Code"):
16
- # Create a prompt for optimization
17
- optimization_prompt = ChatPromptTemplate.from_template(OPTIMIZATION_PROMPT)
18
-
19
- # Create a message template for the user's code
20
- human_message_prompt = HumanMessagePromptTemplate.from_template("{code_snippet}")
21
-
22
- # Combine the system and user message templates
23
- chat_prompt = ChatPromptTemplate.from_messages([optimization_prompt, human_message_prompt])
24
-
25
- # Run the optimization chat chain
26
- optimization_chain = LLMChain(llm=chat, prompt=chat_prompt)
27
- optimized_code = optimization_chain.run(code_snippet=user_code)
28
-
29
- # Display the optimized code
30
- st.subheader("Optimized Code")
31
- st.text_area("", optimized_code, height=200)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
components/refactor_page.py DELETED
@@ -1,12 +0,0 @@
1
- import streamlit as st
2
- from langchain.chat_models import ChatOpenAI
3
-
4
- def show_refactor_page(chat):
5
- st.title("Code Refactoring")
6
- st.write("This page refactors a given code snippet.")
7
-
8
- code_snippet = st.text_area("Enter the code snippet:", height=200)
9
-
10
- if st.button("Refactor Code"):
11
- # Implement the functionality for refactoring code
12
- pass
 
 
 
 
 
 
 
 
 
 
 
 
 
components/style_page.py DELETED
@@ -1,12 +0,0 @@
1
- import streamlit as st
2
- from langchain.chat_models import ChatOpenAI
3
-
4
- def show_style_page(chat):
5
- st.title("Code Style Checker")
6
- st.write("This page checks the style of a given code snippet.")
7
-
8
- code_snippet = st.text_area("Enter the code snippet:", height=200)
9
-
10
- if st.button("Check Style"):
11
- # Implement the functionality for checking code style
12
- pass
 
 
 
 
 
 
 
 
 
 
 
 
 
components/test_page.py DELETED
@@ -1,12 +0,0 @@
1
- import streamlit as st
2
- from langchain.chat_models import ChatOpenAI
3
-
4
- def show_test_page(chat):
5
- st.title("Code Testing")
6
- st.write("This page generates tests for a given code snippet.")
7
-
8
- code_snippet = st.text_area("Enter the code snippet:", height=200)
9
-
10
- if st.button("Generate Tests"):
11
- # Implement the functionality for generating tests
12
- pass