Spaces:
Runtime error
Runtime error
HemanthSai7
commited on
Commit
β’
ed0ae9f
1
Parent(s):
fe58312
Frontend
Browse filesUpdated home page of the Streamlit app
- frontend/images/architecture.png +0 -0
- frontend/images/backend.png +0 -0
- frontend/images/backendss.png +0 -0
- frontend/images/llms.png +0 -0
- frontend/images/techdocs.png +0 -0
- frontend/pages/{3_π_Instructions.py β 2_π_Instructions.py} +0 -0
- frontend/pages/{2_π»_Demo.py β 3_π»_Demo.py} +0 -0
- frontend/π‘_Home.py +43 -20
- testing/DBQueries.py +0 -48
- testing/test.py +0 -92
frontend/images/architecture.png
ADDED
frontend/images/backend.png
ADDED
frontend/images/backendss.png
ADDED
frontend/images/llms.png
ADDED
frontend/images/techdocs.png
ADDED
frontend/pages/{3_π_Instructions.py β 2_π_Instructions.py}
RENAMED
File without changes
|
frontend/pages/{2_π»_Demo.py β 3_π»_Demo.py}
RENAMED
File without changes
|
frontend/π‘_Home.py
CHANGED
@@ -2,23 +2,46 @@ import streamlit as st
|
|
2 |
from layouts.mainlayout import mainlayout
|
3 |
|
4 |
@mainlayout
|
5 |
-
def
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
"""
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
st.
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
from layouts.mainlayout import mainlayout
|
3 |
|
4 |
@mainlayout
|
5 |
+
def home():
|
6 |
+
st.subheader("Code documentation tool that works in your IDE like magic!")
|
7 |
+
|
8 |
+
def changestate(*args):
|
9 |
+
st.session_state[args[0]]=True
|
10 |
+
|
11 |
+
tab1, tab2, tab3 = st.tabs(["About our CLI πͺ", "Mechanics π οΈ", "LLMs toolkit ποΈ"])
|
12 |
+
with tab1:
|
13 |
+
st.markdown('### <div align="center">:green[Our CLI π§βπ»]</div>',unsafe_allow_html=True)
|
14 |
+
st.markdown('##### <div align="center">:blue[Techdocs CLI] provides a simple and easy to use interface to generate documentation for your :blue[code].</div>',unsafe_allow_html=True)
|
15 |
+
col1, col3, col2 = st.columns([4,0.1,2])
|
16 |
+
with col1:
|
17 |
+
st.image("frontend/images/techdocs.png")
|
18 |
+
with col2:
|
19 |
+
st.checkbox("##### User friendly commands\n β
Easy to follow commands to generate documentation for your code.",value=True,key="feature1_a",on_change=changestate,args=("feature1_a",))
|
20 |
+
st.checkbox("##### Your workbench at one place\n β
Access all commands within our CLI. No need to search the app.",value=True,key="feature1_b",on_change=changestate,args=("feature1_b",))
|
21 |
+
st.checkbox("##### Generated documentation will be directly embedded into your functions\n β
No need to manually copy paste the documentation.",value=True,key="feature1_c",on_change=changestate,args=("feature1_c",))
|
22 |
+
|
23 |
+
with tab2:
|
24 |
+
st.markdown('## <div align="center">:green[API behind the Scenes βοΈ]</div>',unsafe_allow_html=True)
|
25 |
+
st.markdown('#### <div align="center">:blue[CLI] uses the power of our API allowing you to access sophisticated :blue[LLM] tools effortlessly. This :blue[microservice] is deployed separately abstracting undelying complexities and providing lightweight web app and CLI </div>',unsafe_allow_html=True)
|
26 |
+
col1, col3, col2 = st.columns([4,0.1,2])
|
27 |
+
with col1:
|
28 |
+
st.image("frontend/images/backendss.png")
|
29 |
+
with col2:
|
30 |
+
st.checkbox("##### API uses the magic of FastAPIβ‘\nβ
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python.",value=True,key="backend_a",on_change=changestate,args=("backend_a",))
|
31 |
+
st.checkbox("##### Deployed on Huggingface Spaces π€\nβ
Minimal user-percieved latency.",value=True,key="backend_b",on_change=changestate,args=("backend_b",))
|
32 |
+
st.checkbox("##### Cloud Databases βοΈ\n β
Powered by Microsoft Azure SQL",value=True,key="backend_c",on_change=changestate,args=("backend_c",))
|
33 |
+
|
34 |
+
with tab3:
|
35 |
+
st.markdown('### <div align="center">:green[Large Language Models π¦]</div>',unsafe_allow_html=True)
|
36 |
+
st.markdown('#### <div align="center">Combines the power of Langchain and Clarifai</div>',unsafe_allow_html=True)
|
37 |
+
col1, col3, col2 = st.columns([4,0.1,2])
|
38 |
+
with col1:
|
39 |
+
st.image("frontend/images/llms.png")
|
40 |
+
|
41 |
+
with col2:
|
42 |
+
st.checkbox('##### WizardLM-70B at its core π§ββοΈ.\nβ
Uses WizardLM-70B LLM as an endpoint provided by Clarifiai.',value=True,key="llm_a",on_change=changestate,args=("llm_a",))
|
43 |
+
st.checkbox("##### Application developed using Langchain π¦.\nβ
LangChain is a framework for developing applications powered by language models.", value=True,key="llm_b",on_change=changestate,args=("llm_b",))
|
44 |
+
|
45 |
+
|
46 |
+
st.markdown("## <div align='center'>Techdocs Architecture</div>",unsafe_allow_html=True)
|
47 |
+
st.image("frontend/images/architecture.png")
|
testing/DBQueries.py
CHANGED
@@ -9,23 +9,6 @@ class DBQueries:
|
|
9 |
|
10 |
@classmethod
|
11 |
def insert_to_database(cls, table_name: str, data: Union[Tuple, List[Tuple]], cols: List[str]=None):
|
12 |
-
"""
|
13 |
-
This method is used to insert data into a specified table in the database.
|
14 |
-
|
15 |
-
Args:
|
16 |
-
table_name (str): The name of the table into which the data will be inserted.
|
17 |
-
data (Union[Tuple, List[Tuple]]): The data to be inserted into the table. It can be either a tuple or a list of tuples.
|
18 |
-
cols (List[str], optional): A list of column names in the table. If not provided, the method will assume all columns are needed. Defaults to None.
|
19 |
-
|
20 |
-
Raises:
|
21 |
-
Exception: If the data type of 'data' is not a tuple or a list of tuples.
|
22 |
-
|
23 |
-
Returns:
|
24 |
-
None
|
25 |
-
"""
|
26 |
-
"\n This method is used to insert data into a specified table in the database.\n\n Args:\n table_name (str): The name of the table into which the data will be inserted.\n data (Union[Tuple, List[Tuple]]): The data to be inserted into the table. It can be either a tuple or a list of tuples.\n cols (List[str], optional): A list of column names in the table. If not provided, the method will assume all columns are needed. Defaults to None.\n\n Raises:\n Exception: If the data type of 'data' is not a tuple or a list of tuples.\n\n Returns:\n None\n "
|
27 |
-
"\n This method is used to insert data into a specified table in the database.\n\n Args:\n table_name (str): The name of the table into which the data will be inserted.\n data (Union[Tuple, List[Tuple]]): The data to be inserted into the table. It can be either a tuple or a list of tuples.\n cols (List[str], optional): A list of column names in the table. If not provided, the method will assume all columns are needed. Defaults to None.\n\n Raises:\n Exception: If the data type of 'data' is not a tuple or a list of tuples.\n\n Returns:\n None\n "
|
28 |
-
"\n This method is used to insert data into a specified table in the database.\n\n Args:\n table_name (str): The name of the table into which the data will be inserted.\n data (Union[Tuple, List[Tuple]]): The data to be inserted into the table. It can be either a tuple or a list of tuples.\n cols (List[str], optional): A list of column names in the table. If not provided, the method will assume all columns are needed. Defaults to None.\n\n Raises:\n Exception: If the data type of 'data' is not a tuple or a list of tuples.\n\n Returns:\n None\n "
|
29 |
con = DBConnection.get_client()
|
30 |
cursor = con.cursor()
|
31 |
QUERY = f"INSERT INTO {{table_name}} ({','.join(cols)}) VALUES ".format(table_name=table_name)
|
@@ -39,22 +22,6 @@ class DBQueries:
|
|
39 |
|
40 |
@classmethod
|
41 |
def fetch_data_from_database(cls, table_name: str, cols_to_fetch: Union[str, List[str]], where_clause: str=None):
|
42 |
-
"""
|
43 |
-
This method fetches data from a specified table in the database based on the specified column(s) and optional WHERE clause.
|
44 |
-
|
45 |
-
Args:
|
46 |
-
table_name (str): The name of the table from which to fetch data.
|
47 |
-
cols_to_fetch (Union[str, List[str]]): The column(s) to fetch from the table. Can be a single string or a list of strings.
|
48 |
-
If a single string, it will be treated as a comma-separated list of columns.
|
49 |
-
where_clause (str, optional): An optional WHERE clause to filter the data. Defaults to None.
|
50 |
-
|
51 |
-
Returns:
|
52 |
-
List[List[str]]: A list of lists, where each inner list represents a row of data fetched from the database.
|
53 |
-
The order of the columns in the inner lists corresponds to the order specified in the cols_to_fetch parameter.
|
54 |
-
|
55 |
-
Raises:
|
56 |
-
None
|
57 |
-
"""
|
58 |
con = DBConnection.get_client()
|
59 |
cursor = con.cursor()
|
60 |
if isinstance(cols_to_fetch, str):
|
@@ -68,21 +35,6 @@ class DBQueries:
|
|
68 |
|
69 |
@classmethod
|
70 |
def update_data_in_database(cls, table_name: str, cols_to_update: Union[str, List[str]], where_clause: str=None, new_values: Union[str, List[str]]=None):
|
71 |
-
"""
|
72 |
-
This method updates the data in the specified table in the database.
|
73 |
-
|
74 |
-
Args:
|
75 |
-
table_name (str): The name of the table to be updated.
|
76 |
-
cols_to_update (Union[str, List[str]]): The column(s) to be updated. If a single string, it should end with '=%s'. If a list, it should contain strings representing the column names followed by '=%s'.
|
77 |
-
where_clause (str, optional): The WHERE clause to specify the conditions for the update. Defaults to None.
|
78 |
-
new_values (Union[str, List[str]], optional): The new values to be updated in the specified columns. If a single string, it should be a list of values. If a list, it should contain the new values for the columns. Defaults to None.
|
79 |
-
|
80 |
-
Returns:
|
81 |
-
bool: Returns True if the update is successful.
|
82 |
-
|
83 |
-
Raises:
|
84 |
-
Exception: Raises an exception if the database connection fails.
|
85 |
-
"""
|
86 |
con = DBConnection.get_client()
|
87 |
cursor = con.cursor()
|
88 |
if isinstance(cols_to_update, str):
|
|
|
9 |
|
10 |
@classmethod
|
11 |
def insert_to_database(cls, table_name: str, data: Union[Tuple, List[Tuple]], cols: List[str]=None):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
con = DBConnection.get_client()
|
13 |
cursor = con.cursor()
|
14 |
QUERY = f"INSERT INTO {{table_name}} ({','.join(cols)}) VALUES ".format(table_name=table_name)
|
|
|
22 |
|
23 |
@classmethod
|
24 |
def fetch_data_from_database(cls, table_name: str, cols_to_fetch: Union[str, List[str]], where_clause: str=None):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
con = DBConnection.get_client()
|
26 |
cursor = con.cursor()
|
27 |
if isinstance(cols_to_fetch, str):
|
|
|
35 |
|
36 |
@classmethod
|
37 |
def update_data_in_database(cls, table_name: str, cols_to_update: Union[str, List[str]], where_clause: str=None, new_values: Union[str, List[str]]=None):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
con = DBConnection.get_client()
|
39 |
cursor = con.cursor()
|
40 |
if isinstance(cols_to_update, str):
|
testing/test.py
CHANGED
@@ -1,110 +1,18 @@
|
|
1 |
def add(a, b):
|
2 |
-
"""
|
3 |
-
This function adds two numbers.
|
4 |
-
|
5 |
-
Arguments:
|
6 |
-
a (int): The first number to be added.
|
7 |
-
b (int): The second number to be added.
|
8 |
-
|
9 |
-
Returns:
|
10 |
-
int: The sum of the two numbers.
|
11 |
-
"""
|
12 |
-
'\n This function adds two numbers.\n\n Arguments:\n a (int): The first number to be added.\n b (int): The second number to be added.\n\n Returns:\n int: The sum of the two numbers.\n '
|
13 |
-
'\n This function adds two numbers.\n\n Arguments:\n a (int): The first number to be added.\n b (int): The second number to be added.\n\n Returns:\n int: The sum of the two numbers.\n '
|
14 |
return a + b
|
15 |
|
16 |
def multiply(a, b):
|
17 |
-
"""
|
18 |
-
This function multiplies two numbers.
|
19 |
-
|
20 |
-
Args:
|
21 |
-
a: A number to be multiplied.
|
22 |
-
This should be a numeric value (int or float).
|
23 |
-
b: Another number to be multiplied.
|
24 |
-
This should be a numeric value (int or float).
|
25 |
-
|
26 |
-
Returns:
|
27 |
-
The product of the two numbers.
|
28 |
-
This will be a numeric value (int or float), representing the result of the multiplication.
|
29 |
-
|
30 |
-
Raises:
|
31 |
-
None
|
32 |
-
|
33 |
-
"""
|
34 |
-
'\n This function multiplies two numbers.\n\n Args:\n a: A number to be multiplied.\n This should be a numeric value (int or float).\n b: Another number to be multiplied.\n This should be a numeric value (int or float).\n\n Returns:\n The product of the two numbers.\n This will be a numeric value (int or float), representing the result of the multiplication.\n\n Raises:\n None\n\n '
|
35 |
-
'\n This function multiplies two numbers.\n\n Args:\n a: A number to be multiplied.\n b: Another number to be multiplied.\n\n Returns:\n The product of the two numbers.\n '
|
36 |
return a * b
|
37 |
|
38 |
def subtract(a, b):
|
39 |
-
"""
|
40 |
-
Subtracts the second number from the first.
|
41 |
-
|
42 |
-
Args:
|
43 |
-
a (int): The first number to be subtracted.
|
44 |
-
b (int): The second number to be subtracted from the first.
|
45 |
-
|
46 |
-
Returns:
|
47 |
-
int: The result of the subtraction.
|
48 |
-
"""
|
49 |
-
'\n Subtracts the second number from the first.\n\n Args:\n a (int): The first number to be subtracted.\n b (int): The second number to be subtracted from the first.\n\n Returns:\n int: The result of the subtraction.\n '
|
50 |
-
'\ndef subtract(a, b):\n '
|
51 |
return a - b
|
52 |
|
53 |
def divide(a, b):
|
54 |
-
"""
|
55 |
-
This function divides the first argument by the second argument.
|
56 |
-
|
57 |
-
Arguments:
|
58 |
-
a (float): The first number to be divided.
|
59 |
-
b (float): The second number to be divided.
|
60 |
-
|
61 |
-
Raises:
|
62 |
-
ValueError: If the second argument is zero, it raises a ValueError with the message 'Cannot divide by zero'.
|
63 |
-
|
64 |
-
Returns:
|
65 |
-
float: The result of the division of the first argument by the second argument.
|
66 |
-
"""
|
67 |
-
"\n This function divides the first argument by the second argument.\n\n Arguments:\n a (float): The first number to be divided.\n b (float): The second number to be divided.\n\n Raises:\n ValueError: If the second argument is zero, it raises a ValueError with the message 'Cannot divide by zero'.\n\n Returns:\n float: The result of the division of the first argument by the second argument.\n "
|
68 |
-
"\n This function divides the first argument by the second argument.\n\n Arguments:\n a -- The first number to be divided. It should be of type float.\n b -- The second number to be divided. It should be of type float.\n\n Raises:\n ValueError -- If the second argument is zero, it raises a ValueError with the message 'Cannot divide by zero'.\n\n Returns:\n float -- The result of the division of the first argument by the second argument.\n "
|
69 |
if b == 0:
|
70 |
raise ValueError('Cannot divide by zero')
|
71 |
return a / b
|
72 |
|
73 |
def func(*args, **kwargs):
|
74 |
-
"""
|
75 |
-
This function searches for specified terms within the input string using a specified search type.
|
76 |
-
|
77 |
-
Parameters:
|
78 |
-
- input_string (str): The string to search within.
|
79 |
-
- search_terms (list): A list of strings to search for within the input_string.
|
80 |
-
- search_type (str, optional): Specifies how the search_terms should be searched within the input_string.
|
81 |
-
Possible values: 'AND' (all search_terms must be present in the input_string), 'OR' (at least one search_term must be present in the input_string). Default is 'AND'.
|
82 |
-
|
83 |
-
Returns:
|
84 |
-
- search_results (list): A list of all occurrences of the search_terms within the input_string.
|
85 |
-
|
86 |
-
Raises:
|
87 |
-
- ValueError: If the search_type is not 'AND' or 'OR'.
|
88 |
-
"""
|
89 |
-
"\nUsage: query(input_string, search_terms, search_type='AND')\n\nThis function searches for specified terms within the input string using a specified search type.\n\nParameters:\n- input_string (str): The string to search within.\n- search_terms (list): A list of strings to search for within the input_string.\n- search_type (str, optional): Specifies how the search_terms should be searched within the input_string.\n Possible values: 'AND' (all search_terms must be present in the input_string), 'OR' (at least one search_term must be present in the input_string). Default is 'AND'.\n\nReturns:\n- search_results (list): A list of all occurrences of the search_terms within the input_string.\n\nRaises:\n- ValueError: If the search_type is not 'AND' or 'OR'.\n"
|
90 |
-
"\nUsage: func(*args, **kwargs)\n\nThis function returns a wrapper function that calls the original function.\n\nParameters:\n- args (tuple): A tuple of non-keyworded arguments to pass to the function.\n- kwargs (dict): A dictionary of keyworded arguments to pass to the function.\n\nReturns:\n- wrapper (function): A new function that calls the original function with the given arguments.\n\nRaises:\n- TypeError: If the arguments passed to the wrapper function do not match the original function's signature.\n"
|
91 |
-
|
92 |
def wrapper(*args, **kwargs):
|
93 |
-
"""
|
94 |
-
This function acts as a wrapper for another function, allowing it to be called with a variety of arguments.
|
95 |
-
|
96 |
-
Arguments:
|
97 |
-
*args (list): any number of positional arguments (default: None)
|
98 |
-
**kwargs (dict): any number of keyword arguments (default: None)
|
99 |
-
|
100 |
-
Returns:
|
101 |
-
Whatever the wrapped function returns (default: None)
|
102 |
-
|
103 |
-
Raises:
|
104 |
-
Whatever exceptions the wrapped function raises (default: None)
|
105 |
-
TypeError: If any argument is not of the expected type.
|
106 |
-
"""
|
107 |
-
'\n This function performs a specific operation on the given arguments.\n\n Arguments:\n arg1 -- a string argument (default: None)\n arg2 -- an integer argument (default: None)\n arg3 -- a floating point number argument (default: None)\n arg4 -- a boolean argument (default: None)\n\n Returns:\n None\n\n Raises:\n TypeError -- If any argument is not of the expected type.\n '
|
108 |
-
'\n This function acts as a wrapper for another function, allowing it to be called with a variety of arguments.\n\n Arguments:\n *args -- any number of positional arguments (default: None)\n **kwargs -- any number of keyword arguments (default: None)\n\n Returns:\n Whatever the wrapped function returns (default: None)\n\n Raises:\n Whatever exceptions the wrapped function raises (default: None)\n '
|
109 |
return func(*args, **kwargs)
|
110 |
return wrapper
|
|
|
1 |
def add(a, b):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
return a + b
|
3 |
|
4 |
def multiply(a, b):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
return a * b
|
6 |
|
7 |
def subtract(a, b):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
return a - b
|
9 |
|
10 |
def divide(a, b):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
if b == 0:
|
12 |
raise ValueError('Cannot divide by zero')
|
13 |
return a / b
|
14 |
|
15 |
def func(*args, **kwargs):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
def wrapper(*args, **kwargs):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
return func(*args, **kwargs)
|
18 |
return wrapper
|