Spaces:
Runtime error
Runtime error
Merge pull request #5 from HemanthSai7/main
Browse files- backend/services/db/utils/DBQueries.py +0 -5
- frontend/Login.py +1 -1
- frontend/pages/Code.py +7 -10
- requirements.txt +3 -2
backend/services/db/utils/DBQueries.py
CHANGED
@@ -1,8 +1,3 @@
|
|
1 |
-
# fix ObjectId & FastApi conflict
|
2 |
-
import pydantic
|
3 |
-
from bson.objectid import ObjectId
|
4 |
-
pydantic.json.ENCODERS_BY_TYPE[ObjectId]=str
|
5 |
-
|
6 |
from typing import Union, Tuple, List
|
7 |
|
8 |
from backend.utils import DBConnection
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from typing import Union, Tuple, List
|
2 |
|
3 |
from backend.utils import DBConnection
|
frontend/Login.py
CHANGED
@@ -6,7 +6,7 @@ import streamlit as st
|
|
6 |
|
7 |
def auth_page():
|
8 |
|
9 |
-
base_url = '
|
10 |
|
11 |
|
12 |
headers={"accept":"application/json"}
|
|
|
6 |
|
7 |
def auth_page():
|
8 |
|
9 |
+
base_url = 'https://hemanthsai7-techdocsapi.hf.space'
|
10 |
|
11 |
|
12 |
headers={"accept":"application/json"}
|
frontend/pages/Code.py
CHANGED
@@ -4,8 +4,6 @@ from PIL import Image
|
|
4 |
|
5 |
import streamlit as st
|
6 |
from Login import auth_page
|
7 |
-
# frontend.Login import auth_pageom from streamlit_extras import
|
8 |
-
|
9 |
|
10 |
st.set_page_config(
|
11 |
page_title="Welcome",
|
@@ -14,7 +12,7 @@ st.set_page_config(
|
|
14 |
initial_sidebar_state="expanded",
|
15 |
)
|
16 |
|
17 |
-
st.write("#
|
18 |
|
19 |
def logout():
|
20 |
del st.session_state["access_token"]
|
@@ -30,7 +28,7 @@ with st.sidebar:
|
|
30 |
if st.button("Generate API KEY"):
|
31 |
with st.spinner("Generating API Key..."):
|
32 |
try:
|
33 |
-
base_url = "
|
34 |
headers={"accept":"application/json", "Authorization": f"Bearer {st.session_state.access_token}"}
|
35 |
response = requests.put(url=base_url + "/auth/regenerate_api_key", headers=headers, data=json.dumps({"username":st.session_state.username}))
|
36 |
if (response.status_code!=200):
|
@@ -50,7 +48,7 @@ with st.sidebar:
|
|
50 |
|
51 |
|
52 |
def code_page():
|
53 |
-
base_url = '
|
54 |
|
55 |
def query_post(url, headers, data=None, params=None):
|
56 |
response = requests.post(url, data=data, headers=headers, params=params)
|
@@ -58,15 +56,14 @@ def code_page():
|
|
58 |
|
59 |
headers={"accept":"application/json"}
|
60 |
|
61 |
-
|
62 |
API_KEY = st.text_input(label="Enter your API key", label_visibility="hidden",placeholder="Enter your API key", type="password")
|
63 |
-
st.
|
64 |
-
st.write("Enter your code and click 'Generate Comment' to get the corresponding comment.")
|
65 |
|
66 |
-
code_input = st.text_area("Code Input", height=
|
67 |
comment_placeholder = st.empty()
|
68 |
|
69 |
-
if st.button("Generate
|
70 |
if code_input:
|
71 |
headers['Authorization'] = f"Bearer {st.session_state.access_token}"
|
72 |
response = query_post(base_url + '/api/inference', headers=headers, params={'code_block':code_input, 'api_key':API_KEY})
|
|
|
4 |
|
5 |
import streamlit as st
|
6 |
from Login import auth_page
|
|
|
|
|
7 |
|
8 |
st.set_page_config(
|
9 |
page_title="Welcome",
|
|
|
12 |
initial_sidebar_state="expanded",
|
13 |
)
|
14 |
|
15 |
+
st.write("# Welcome to Techdocs: Where Code Meets Clarity! π")
|
16 |
|
17 |
def logout():
|
18 |
del st.session_state["access_token"]
|
|
|
28 |
if st.button("Generate API KEY"):
|
29 |
with st.spinner("Generating API Key..."):
|
30 |
try:
|
31 |
+
base_url = "https://hemanthsai7-techdocsapi.hf.space"
|
32 |
headers={"accept":"application/json", "Authorization": f"Bearer {st.session_state.access_token}"}
|
33 |
response = requests.put(url=base_url + "/auth/regenerate_api_key", headers=headers, data=json.dumps({"username":st.session_state.username}))
|
34 |
if (response.status_code!=200):
|
|
|
48 |
|
49 |
|
50 |
def code_page():
|
51 |
+
base_url = 'https://hemanthsai7-techdocsapi.hf.space'
|
52 |
|
53 |
def query_post(url, headers, data=None, params=None):
|
54 |
response = requests.post(url, data=data, headers=headers, params=params)
|
|
|
56 |
|
57 |
headers={"accept":"application/json"}
|
58 |
|
59 |
+
st.subheader("Enter your API key to generate documentation.")
|
60 |
API_KEY = st.text_input(label="Enter your API key", label_visibility="hidden",placeholder="Enter your API key", type="password")
|
61 |
+
st.subheader("Enter your code and click 'Generate Documentation' to get the corresponding comment.")
|
|
|
62 |
|
63 |
+
code_input = st.text_area("Code Input", height=300)
|
64 |
comment_placeholder = st.empty()
|
65 |
|
66 |
+
if st.button("Generate Documentation"):
|
67 |
if code_input:
|
68 |
headers['Authorization'] = f"Bearer {st.session_state.access_token}"
|
69 |
response = query_post(base_url + '/api/inference', headers=headers, params={'code_block':code_input, 'api_key':API_KEY})
|
requirements.txt
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
fastapi==0.99.1
|
2 |
uvicorn
|
3 |
requests
|
|
|
|
|
|
|
4 |
pydantic==1.10.12
|
5 |
python-jose[cryptography]
|
6 |
passlib[bcrypt]
|
7 |
mysql-connector-python
|
8 |
pydantic[email]
|
9 |
-
langchain==0.0.295
|
10 |
-
clarifai
|
|
|
1 |
fastapi==0.99.1
|
2 |
uvicorn
|
3 |
requests
|
4 |
+
langchain
|
5 |
+
clarifai
|
6 |
+
Pillow
|
7 |
pydantic==1.10.12
|
8 |
python-jose[cryptography]
|
9 |
passlib[bcrypt]
|
10 |
mysql-connector-python
|
11 |
pydantic[email]
|
|
|
|