Spaces:
Runtime error
Runtime error
Hemanth Sai Garladinne
commited on
Commit
โข
fbb7c49
1
Parent(s):
e3122d2
Code refactor (#35)
Browse files* Code restructuring for frontend module
* Code restructuring for frontend module
- {frontend/.streamlit โ .streamlit}/config.toml +0 -0
- frontend/__init__.py +0 -0
- frontend/components/__init__.py +4 -0
- frontend/components/authors.py +16 -0
- frontend/{Login.py โ components/login.py} +3 -12
- frontend/components/logout.py +6 -0
- frontend/components/user_greetings.py +12 -0
- frontend/content/installation.md +8 -0
- frontend/content/working.md +33 -0
- frontend/layouts/__init__.py +0 -0
- frontend/layouts/mainlayout.py +27 -0
- frontend/layouts/st_page_layouts.json +20 -0
- frontend/pages/{Code.py โ 2_๐ป_Demo.py} +19 -64
- frontend/pages/3_๐_Instructions.py +23 -0
- frontend/pages/Usage.py +0 -84
- frontend/๐ก_Home.py +11 -93
{frontend/.streamlit โ .streamlit}/config.toml
RENAMED
File without changes
|
frontend/__init__.py
ADDED
File without changes
|
frontend/components/__init__.py
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from .authors import authors
|
2 |
+
from .logout import logout
|
3 |
+
from .login import login
|
4 |
+
from .user_greetings import user_greetings
|
frontend/components/authors.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import streamlit as st
|
3 |
+
|
4 |
+
def authors():
|
5 |
+
# {"Github โ " "["username"]" "("url")" for username,url in author_details["socials"].items() }
|
6 |
+
# with open("frontend/contend/authors.json","r") as f:
|
7 |
+
# author_details = json.load(f)
|
8 |
+
st.sidebar.divider()
|
9 |
+
st.sidebar.info(
|
10 |
+
"""
|
11 |
+
Follow us on:
|
12 |
+
|
13 |
+
Github โ [@mayureshagashe2105](https://github.com/MayureshAgashe2105)\n
|
14 |
+
Github โ [@HemanthSai7](https://github.com/HemanthSai7)
|
15 |
+
"""
|
16 |
+
)
|
frontend/{Login.py โ components/login.py}
RENAMED
@@ -4,7 +4,7 @@ import requests
|
|
4 |
import streamlit as st
|
5 |
|
6 |
|
7 |
-
def
|
8 |
|
9 |
base_url = 'https://caffeinecrew-techdocs.hf.space'
|
10 |
|
@@ -53,18 +53,9 @@ def auth_page():
|
|
53 |
|
54 |
st.success("Signed up successfully")
|
55 |
except:
|
56 |
-
st.error("Signup Failed")
|
57 |
|
58 |
-
|
59 |
-
st.sidebar.divider()
|
60 |
-
st.sidebar.info(
|
61 |
-
"""
|
62 |
-
Follow us on:
|
63 |
-
|
64 |
-
Github โ [@mayureshagashe2105](https://github.com/MayureshAgashe2105)\n
|
65 |
-
Github โ [@HemanthSai7](https://github.com/HemanthSai7)
|
66 |
-
"""
|
67 |
-
)
|
68 |
|
69 |
|
70 |
|
|
|
4 |
import streamlit as st
|
5 |
|
6 |
|
7 |
+
def login():
|
8 |
|
9 |
base_url = 'https://caffeinecrew-techdocs.hf.space'
|
10 |
|
|
|
53 |
|
54 |
st.success("Signed up successfully")
|
55 |
except:
|
56 |
+
st.error("Signup Failed")
|
57 |
|
58 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
|
61 |
|
frontend/components/logout.py
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
def logout():
|
4 |
+
del st.session_state["access_token"]
|
5 |
+
del st.session_state["refresh_token"]
|
6 |
+
del st.session_state["username"]
|
frontend/components/user_greetings.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from .logout import logout
|
3 |
+
|
4 |
+
def user_greetings():
|
5 |
+
with st.sidebar.expander("๐งAccount Details",expanded=True):
|
6 |
+
if 'username' not in st.session_state:
|
7 |
+
st.warning("Please Login or Signup to continue")
|
8 |
+
else:
|
9 |
+
st.info(f"Welcome, {st.session_state.username}! ๐")
|
10 |
+
if st.button("Logout ๐"):
|
11 |
+
logout()
|
12 |
+
st.rerun()
|
frontend/content/installation.md
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
1. Python version requirement:
|
2 |
+
```bash
|
3 |
+
$ python >= 3.10
|
4 |
+
```
|
5 |
+
2. Install Techdocs via pip:
|
6 |
+
```bash
|
7 |
+
$ pip install techdocs
|
8 |
+
```
|
frontend/content/working.md
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
1. Navigate into your project directory.
|
2 |
+
|
3 |
+
```bash
|
4 |
+
$ cd <YOUR-PROJECT-DIRECTORY>
|
5 |
+
```
|
6 |
+
|
7 |
+
2. Once the installation is complete, type `techdocs` in the terminal. You should be able to see info about our CLI.
|
8 |
+
|
9 |
+
```bash
|
10 |
+
$ techdocs
|
11 |
+
```
|
12 |
+
|
13 |
+
3. If you are a `new user`, `signup` for a new account using the command below **OR** Head on to [Techdocs](https://techdocs.streamlit.app) and signup for a new account.
|
14 |
+
|
15 |
+
```bash
|
16 |
+
$ techdocs signup -u <username> -p <password> -e <email>
|
17 |
+
```
|
18 |
+
|
19 |
+
4. If you already have your `API KEY`, you can skip step 5.
|
20 |
+
|
21 |
+
5. Generate your `API key` using the command below **OR** Head on to [Techdocs](https://techdocs.streamlit.app/demo) and generate your `API KEY`.
|
22 |
+
|
23 |
+
```bash
|
24 |
+
$ techdocs apikey -u <username> -p <password>
|
25 |
+
```
|
26 |
+
|
27 |
+
6. Once you have your `API key`, you can generate the documentation using the command below.
|
28 |
+
|
29 |
+
```bash
|
30 |
+
$ techdocs generate -k <API_KEY> -u <USERNAME> -p <PASSWORD> -d <ROOT-DIRECTORY-OF-THE-PROJECT>
|
31 |
+
```
|
32 |
+
|
33 |
+
6. Wait for the `documentation` to be generated. Your `.py` files will be parsed and the documentation will be generated in the files itself. The tool will log the progress in the terminal and the file will be updated once all the functions are parsed.
|
frontend/layouts/__init__.py
ADDED
File without changes
|
frontend/layouts/mainlayout.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import streamlit as st
|
3 |
+
|
4 |
+
from typing import Callable
|
5 |
+
|
6 |
+
from components import authors, user_greetings, login
|
7 |
+
|
8 |
+
def mainlayout(func: Callable):
|
9 |
+
with open("layouts/st_page_layouts.json", "r",encoding='utf-8') as f:
|
10 |
+
st_page_layouts = json.load(f)
|
11 |
+
st.set_page_config(**st_page_layouts[f"{func.__name__}" if func.__name__ in st_page_layouts.keys() else "home"])
|
12 |
+
st.markdown("## :rainbow[Welcome to Techdocs: Where Code Meets Clarity!]๐")
|
13 |
+
|
14 |
+
user_greetings()
|
15 |
+
|
16 |
+
if 'access_token' not in st.session_state:
|
17 |
+
st.session_state.runpage = login
|
18 |
+
else:
|
19 |
+
st.session_state.runpage = func
|
20 |
+
|
21 |
+
def load_page():
|
22 |
+
return st.session_state.runpage()
|
23 |
+
load_page()
|
24 |
+
authors()
|
25 |
+
|
26 |
+
|
27 |
+
|
frontend/layouts/st_page_layouts.json
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"home": {
|
3 |
+
"page_title": "Techdocs",
|
4 |
+
"layout": "wide",
|
5 |
+
"page_icon": "๐ก",
|
6 |
+
"initial_sidebar_state": "expanded"
|
7 |
+
},
|
8 |
+
"demo": {
|
9 |
+
"page_title": "demo",
|
10 |
+
"layout": "wide",
|
11 |
+
"page_icon": "๐ป",
|
12 |
+
"initial_sidebar_state": "expanded"
|
13 |
+
},
|
14 |
+
"instructions": {
|
15 |
+
"page_title": "Instructions",
|
16 |
+
"layout": "wide",
|
17 |
+
"page_icon": "๐",
|
18 |
+
"initial_sidebar_state": "expanded"
|
19 |
+
}
|
20 |
+
}
|
frontend/pages/{Code.py โ 2_๐ป_Demo.py}
RENAMED
@@ -2,55 +2,38 @@ import json
|
|
2 |
import requests
|
3 |
|
4 |
import streamlit as st
|
5 |
-
from
|
6 |
|
7 |
-
st.set_page_config(
|
8 |
-
page_title="Code",
|
9 |
-
page_icon="๐จโ๐ป",
|
10 |
-
layout="wide",
|
11 |
-
initial_sidebar_state="expanded",
|
12 |
-
)
|
13 |
|
14 |
-
|
|
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
|
|
17 |
|
18 |
-
|
19 |
-
del st.session_state["access_token"]
|
20 |
-
del st.session_state["refresh_token"]
|
21 |
-
del st.session_state["username"]
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
st.markdown(
|
27 |
-
"""
|
28 |
-
##### 1. Generate an `API Key` from the sidebar to get started.
|
29 |
|
30 |
-
|
|
|
31 |
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
##### 5. The `generated documentation` will be displayed in the section below.
|
37 |
-
|
38 |
-
"""
|
39 |
-
)
|
40 |
-
|
41 |
-
|
42 |
-
with st.sidebar:
|
43 |
-
if 'username' not in st.session_state:
|
44 |
-
with st.expander("๐งAccount Details",expanded=True):
|
45 |
-
st.warning("Please Login or Signup to continue")
|
46 |
-
else:
|
47 |
-
|
48 |
with st.expander("๐ TECHDOCS-API-KEY",expanded=True):
|
49 |
st.warning("Generating a new API Key will invalidate the previous one from all your projects. Do you wish to continue?")
|
50 |
if st.button("Generate API KEY"):
|
51 |
with st.spinner("Generating API Key..."):
|
52 |
try:
|
53 |
-
base_url = "https://caffeinecrew-techdocs.hf.space"
|
54 |
headers={"accept":"application/json", "Authorization": f"Bearer {st.session_state.access_token}"}
|
55 |
response = requests.put(url=base_url + "/auth/regenerate_api_key", headers=headers, data=json.dumps({"username":st.session_state.username}))
|
56 |
if (response.status_code!=200):
|
@@ -59,20 +42,9 @@ with st.sidebar:
|
|
59 |
st.code(response.json()["api_key"],"bash")
|
60 |
st.success("API Key Generated Successfully")
|
61 |
except Exception as e:
|
62 |
-
st.error(e)
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
with st.expander("๐งAccount Details",expanded=True):
|
67 |
-
st.info(f"Welcome, {st.session_state.username}! ๐")
|
68 |
-
if st.button("Logout ๐"):
|
69 |
-
logout()
|
70 |
-
st.rerun()
|
71 |
|
72 |
|
73 |
-
def code_page():
|
74 |
-
base_url = 'https://caffeinecrew-techdocs.hf.space'
|
75 |
-
|
76 |
def query_post(url, headers, data=None, params=None):
|
77 |
response = requests.post(url, data=data, headers=headers, params=params)
|
78 |
return response
|
@@ -101,20 +73,3 @@ def code_page():
|
|
101 |
comment_placeholder.markdown(f"<pre><code>{docstr}</code></pre>", unsafe_allow_html=True)
|
102 |
else:
|
103 |
st.warning("Please enter some code.")
|
104 |
-
|
105 |
-
st.sidebar.divider()
|
106 |
-
st.sidebar.info(
|
107 |
-
"""
|
108 |
-
Follow us on:
|
109 |
-
|
110 |
-
Github โ [@mayureshagashe2105](https://github.com/MayureshAgashe2105)\n
|
111 |
-
Github โ [@HemanthSai7](https://github.com/HemanthSai7)
|
112 |
-
"""
|
113 |
-
)
|
114 |
-
|
115 |
-
|
116 |
-
if 'access_token' not in st.session_state:
|
117 |
-
st.session_state.runpage = auth_page
|
118 |
-
else:
|
119 |
-
st.session_state.runpage = code_page
|
120 |
-
st.session_state.runpage()
|
|
|
2 |
import requests
|
3 |
|
4 |
import streamlit as st
|
5 |
+
from layouts.mainlayout import mainlayout
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
+
@mainlayout
|
9 |
+
def demo():
|
10 |
|
11 |
+
def instructions():
|
12 |
+
with st.expander("๐Instructions",expanded=True):
|
13 |
+
st.info("Please note that the Streamlit app is just a demo to give the user an idea of the project. To witness the full power of Techdocs, please use the CLI. The instructions to use the CLI are listed in Usage page")
|
14 |
+
st.markdown(
|
15 |
+
"""
|
16 |
+
##### 1. Generate an `API Key` from the sidebar to get started.
|
17 |
|
18 |
+
##### 2. Paste the `API Key` in the field provided.
|
19 |
|
20 |
+
##### 3. Paste your `code function` in the input code box.
|
|
|
|
|
|
|
21 |
|
22 |
+
##### 4. Click on the `Generate Documentation` ๐ค button to generate the documentation.
|
23 |
+
|
24 |
+
##### 5. The `generated documentation` will be displayed in the section below.
|
|
|
|
|
|
|
25 |
|
26 |
+
"""
|
27 |
+
)
|
28 |
|
29 |
+
base_url = 'https://caffeinecrew-techdocs.hf.space'
|
30 |
|
31 |
+
with st.sidebar:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
with st.expander("๐ TECHDOCS-API-KEY",expanded=True):
|
33 |
st.warning("Generating a new API Key will invalidate the previous one from all your projects. Do you wish to continue?")
|
34 |
if st.button("Generate API KEY"):
|
35 |
with st.spinner("Generating API Key..."):
|
36 |
try:
|
|
|
37 |
headers={"accept":"application/json", "Authorization": f"Bearer {st.session_state.access_token}"}
|
38 |
response = requests.put(url=base_url + "/auth/regenerate_api_key", headers=headers, data=json.dumps({"username":st.session_state.username}))
|
39 |
if (response.status_code!=200):
|
|
|
42 |
st.code(response.json()["api_key"],"bash")
|
43 |
st.success("API Key Generated Successfully")
|
44 |
except Exception as e:
|
45 |
+
st.error(e)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
|
|
|
|
|
|
|
48 |
def query_post(url, headers, data=None, params=None):
|
49 |
response = requests.post(url, data=data, headers=headers, params=params)
|
50 |
return response
|
|
|
73 |
comment_placeholder.markdown(f"<pre><code>{docstr}</code></pre>", unsafe_allow_html=True)
|
74 |
else:
|
75 |
st.warning("Please enter some code.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
frontend/pages/3_๐_Instructions.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from PIL import Image
|
3 |
+
|
4 |
+
from layouts.mainlayout import mainlayout
|
5 |
+
|
6 |
+
@mainlayout
|
7 |
+
def instructions():
|
8 |
+
with open("content/installation.md", "r",encoding='utf-8') as f:
|
9 |
+
instructions = f.read()
|
10 |
+
|
11 |
+
with open("content/working.md", "r",encoding='utf-8') as f:
|
12 |
+
working = f.read()
|
13 |
+
|
14 |
+
|
15 |
+
st.markdown("### ๐ :rainbow[Using Techdocs via the CLI]")
|
16 |
+
st.info("Please use the CLI to generate the documentation for your project. The Streamlit app is just a demo to give the user an idea of the project.")
|
17 |
+
st.warning("To start using the CLI, please generate an API Key from the Streamlit app. You can also generate the API Key from the CLI.")
|
18 |
+
|
19 |
+
with st.expander("โ๏ธ Installation and setup"):
|
20 |
+
st.markdown(instructions)
|
21 |
+
|
22 |
+
with st.expander("๐ CLI and Working", expanded=True):
|
23 |
+
st.markdown(working)
|
frontend/pages/Usage.py
DELETED
@@ -1,84 +0,0 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
from Login import auth_page
|
3 |
-
from PIL import Image
|
4 |
-
|
5 |
-
st.set_page_config(
|
6 |
-
page_title="Usage",
|
7 |
-
layout="wide",
|
8 |
-
page_icon="๐",
|
9 |
-
initial_sidebar_state="expanded",
|
10 |
-
)
|
11 |
-
|
12 |
-
st.markdown("## :rainbow[Welcome to Techdocs: Where Code Meets Clarity!]๐")
|
13 |
-
|
14 |
-
def logout():
|
15 |
-
del st.session_state["access_token"]
|
16 |
-
del st.session_state["refresh_token"]
|
17 |
-
del st.session_state["username"]
|
18 |
-
|
19 |
-
with st.sidebar.expander("๐งAccount Details",expanded=True):
|
20 |
-
if 'username' not in st.session_state:
|
21 |
-
st.warning("Please Login or Signup to continue")
|
22 |
-
else:
|
23 |
-
st.info(f"Welcome, {st.session_state.username}! ๐")
|
24 |
-
if st.button("Logout ๐"):
|
25 |
-
logout()
|
26 |
-
st.rerun()
|
27 |
-
|
28 |
-
def usage():
|
29 |
-
st.markdown("### :rainbow[How to use Techdocs?]")
|
30 |
-
|
31 |
-
col1,col2 = st.columns(2,gap="small")
|
32 |
-
|
33 |
-
with col1:
|
34 |
-
|
35 |
-
img = Image.open("frontend/images/image.png")
|
36 |
-
st.image(img)
|
37 |
-
|
38 |
-
st.caption("Boat sailing in the sea")
|
39 |
-
|
40 |
-
with col2:
|
41 |
-
intro_text="""
|
42 |
-
Now that you've arrived at this digital crossroads, you're most likely eager to dive into the world of Techdocs. Great choice! In today's fast-paced tech landscape, having well-structured and easily accessible documentation is like having a treasure map to navigate the vast ocean of code. You are probably wondering how to use Techdocs.
|
43 |
-
"""
|
44 |
-
|
45 |
-
text="""
|
46 |
-
But you might be wondering: "How do I embark on this documentation journey with Techdocs?" Fear not, because we're about to chart a course through the fascinating world of Techdocs, where clarity, efficiency, and ease-of-use are the guiding stars.
|
47 |
-
"""
|
48 |
-
st.write(f'<p style="font-size:22px; color:#9c9d9f ">{intro_text}</p>', unsafe_allow_html=True)
|
49 |
-
st.write(f'<p style="color:#9c9d9f; font-size:22px">{text}</p>', unsafe_allow_html=True)
|
50 |
-
|
51 |
-
st.markdown("### ๐ :rainbow[Using Techdocs via the CLI]")
|
52 |
-
st.info("Please use the CLI to generate the documentation for your project. The Streamlit app is just a preview to give the user an idea of the project.")
|
53 |
-
st.warning("To start using the CLI, please generate an API Key from the Streamlit app. You can also generate the API Key from the CLI.")
|
54 |
-
|
55 |
-
with st.expander("โ๏ธ Installation and setup",expanded=True):
|
56 |
-
st.write("1. Create a virtual environment. We recommend using conda but you can python's venv as well:"); st.code("conda create -n techdocs python=3.11","python")
|
57 |
-
st.write("2. Install Techdocs via pip:"); st.code("pip install techdocs","python")
|
58 |
-
st.write("3. CD into your project directory.")
|
59 |
-
st.code("CD <YOUR-PROJECT-DIRECTORY>","bash")
|
60 |
-
|
61 |
-
with st.expander("๐ CLI and Working", expanded=True):
|
62 |
-
st.write("1. Once the installation is complete, type **techdocs** in the terminal. You should be able to see info about our CLI.")
|
63 |
-
st.write("2. You can login into our Techdocs app using the CLI or create an account if you don't have one. To signup, type the following command in the terminal:")
|
64 |
-
st.code("techdocs signup -u <username> -p <password> -e <email>", "bash")
|
65 |
-
st.write("3. Generate an API Key from the Code page and paste it in the command below.")
|
66 |
-
st.code("techdocs generate -k <API_KEY> -u <USERNAME> -p <PASSWORD> -d <ROOT-DIRECTORY-OF-THE-PROJECT>","bash")
|
67 |
-
st.write("4. Wait for the documentation to be generated. You can view the status of the documentation generation in the CLI.")
|
68 |
-
|
69 |
-
st.sidebar.divider()
|
70 |
-
st.sidebar.info(
|
71 |
-
"""
|
72 |
-
Follow us on:
|
73 |
-
|
74 |
-
Github โ [@mayureshagashe2105](https://github.com/MayureshAgashe2105)\n
|
75 |
-
Github โ [@HemanthSai7](https://github.com/HemanthSai7)
|
76 |
-
"""
|
77 |
-
)
|
78 |
-
|
79 |
-
|
80 |
-
if 'access_token' not in st.session_state:
|
81 |
-
st.session_state.runpage = auth_page
|
82 |
-
else:
|
83 |
-
st.session_state.runpage = usage
|
84 |
-
st.session_state.runpage()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
frontend/๐ก_Home.py
CHANGED
@@ -1,106 +1,24 @@
|
|
1 |
import streamlit as st
|
2 |
-
from
|
3 |
-
|
4 |
-
import base64
|
5 |
-
|
6 |
-
st.set_page_config(
|
7 |
-
page_title="Techdocs",
|
8 |
-
layout="wide",
|
9 |
-
page_icon="๐ก",
|
10 |
-
initial_sidebar_state="expanded"
|
11 |
-
)
|
12 |
-
|
13 |
-
@st.cache_data
|
14 |
-
def get_base64_bin_file(bin_file):
|
15 |
-
with open(bin_file, 'rb') as f:
|
16 |
-
data = f.read()
|
17 |
-
return base64.b64encode(data).decode()
|
18 |
-
|
19 |
-
st.markdown("## :rainbow[Welcome to Techdocs: Where Code Meets Clarity!]๐")
|
20 |
-
|
21 |
-
def logout():
|
22 |
-
del st.session_state["access_token"]
|
23 |
-
del st.session_state["refresh_token"]
|
24 |
-
del st.session_state["username"]
|
25 |
-
|
26 |
-
with st.sidebar.expander("๐งAccount Details",expanded=True):
|
27 |
-
if 'username' not in st.session_state:
|
28 |
-
st.warning("Please Login or Signup to continue")
|
29 |
-
else:
|
30 |
-
st.info(f"Welcome, {st.session_state.username}! ๐")
|
31 |
-
if st.button("Logout ๐"):
|
32 |
-
logout()
|
33 |
-
st.rerun()
|
34 |
-
|
35 |
|
|
|
36 |
def home_page():
|
37 |
|
38 |
-
|
39 |
-
def set_page_background(png_file):
|
40 |
-
bin_str = get_base64_bin_file(png_file)
|
41 |
-
page_bg_img = f'''
|
42 |
-
<style>
|
43 |
-
.stApp {{
|
44 |
-
background-image: url("data:image/jpg;base64,{bin_str}");
|
45 |
-
background-size: cover;
|
46 |
-
background-repeat: no-repeat;
|
47 |
-
background-attachment: scroll;
|
48 |
-
}}
|
49 |
-
</style>
|
50 |
-
'''
|
51 |
-
st.markdown(page_bg_img, unsafe_allow_html=True)
|
52 |
-
|
53 |
-
# set_page_background("../assets/bg.jpg")
|
54 |
-
|
55 |
st.markdown(
|
56 |
-
|
57 |
-
|
58 |
-
##### Unleash the documentation dynamo that is **Techdocs**! Say goodbye to the documentation drudgery that haunts coders' dreams and embrace the effortless power of AI-driven documentation. With **Techdocs**, harness the genius of LLama2, the magic of WizardCoderLM, the versatility of Huggingface Transformers, and the precision of Langchain and Clarifai.
|
59 |
-
|
60 |
-
## :rainbow[How Does Techdocs Work Its Magic?] ๐ฎ
|
61 |
-
|
62 |
-
##### Just feed your code into **Techdocs**, and like a seasoned wizard, it'll conjure up beautifully detailed documentation in an instant. Your code will transform into a masterpiece of clarity, complete with insightful comments, vivid descriptions, crystal-clear parameters, return values, and real-world examples.
|
63 |
|
64 |
"""
|
65 |
)
|
66 |
|
67 |
with st.expander("What Can Techdocs Do for You? ๐",expanded=True):
|
68 |
st.markdown(
|
69 |
-
"""
|
70 |
-
- ##### Boost your code quality effortlessly ๐.
|
71 |
-
- ##### Share your brilliance with the world in a snap ๐.
|
72 |
-
- ##### Effortlessly generate documentation for your code ๐ค.
|
73 |
-
- ##### Include comments, descriptions, parameters, return values, and real-life examples ๐.
|
74 |
-
- ##### Elevate your code's readability, maintainability, and quality ๐.
|
75 |
"""
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
"""
|
82 |
-
|
83 |
-
|
84 |
-
st.markdown("""
|
85 |
-
## :rainbow[Ready to use Techdocs?]
|
86 |
-
##### Head over to the `Usage page` to get started!๐
|
87 |
-
""")
|
88 |
-
|
89 |
-
|
90 |
-
st.sidebar.divider()
|
91 |
-
st.sidebar.info(
|
92 |
-
"""
|
93 |
-
Follow us on:
|
94 |
-
|
95 |
-
Github โ [@mayureshagashe2105](https://github.com/MayureshAgashe2105)\n
|
96 |
-
Github โ [@HemanthSai7](https://github.com/HemanthSai7)
|
97 |
-
"""
|
98 |
-
)
|
99 |
-
|
100 |
-
|
101 |
-
if 'access_token' not in st.session_state:
|
102 |
-
st.session_state.runpage = auth_page
|
103 |
-
else:
|
104 |
-
st.session_state.runpage = home_page
|
105 |
-
st.session_state.runpage()
|
106 |
-
|
|
|
1 |
import streamlit as st
|
2 |
+
from layouts.mainlayout import mainlayout
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
+
@mainlayout
|
5 |
def home_page():
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
st.markdown(
|
8 |
+
"""
|
9 |
+
##### Unleash the documentation dynamo that is **Techdocs**! Say goodbye to the documentation drudgery that haunts coders' dreams and embrace the effortless power of AI-driven documentation. With **Techdocs**, harness the genius of LLama2 ๐ฆ, the magic of WizardCoderLM ๐งโโ๏ธ, the versatility of Huggingface Transformers ๐ค, and the precision of Langchain ๐ฆ and Clarifai ๐ค.
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
"""
|
12 |
)
|
13 |
|
14 |
with st.expander("What Can Techdocs Do for You? ๐",expanded=True):
|
15 |
st.markdown(
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
"""
|
17 |
+
- Boost your code quality effortlessly ๐.
|
18 |
+
- Effortlessly generate documentation for your code ๐ค.
|
19 |
+
- Include comments, descriptions, parameters, return values, and real-life examples ๐.
|
20 |
+
- Elevate your code's readability, maintainability, and quality ๐.
|
21 |
+
#
|
22 |
"""
|
23 |
+
)
|
24 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|