Spaces:
Sleeping
Sleeping
Upload 23 files
Browse files- .idea/.gitignore +3 -0
- .idea/GorillaLLM.iml +10 -0
- .idea/inspectionProfiles/Project_Default.xml +105 -0
- .idea/inspectionProfiles/profiles_settings.xml +6 -0
- .idea/misc.xml +4 -0
- .idea/modules.xml +8 -0
- .idea/vcs.xml +6 -0
- LISCENSE +21 -0
- Procfile +1 -0
- generated_code_gorilla_7b_hf_v1.py +31 -0
- img.png +0 -0
- img_1.png +0 -0
- img_2.png +0 -0
- main.py +158 -0
- readme.md +74 -0
- requirements.txt +5 -0
- static/res/Icon.png +0 -0
- static/res/favicon.png +0 -0
- static/res/github.png +0 -0
- static/res/linkedin.png +0 -0
- static/res/medium.png +0 -0
- static/res/web.png +0 -0
- static/style.css +76 -0
.idea/.gitignore
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
# Default ignored files
|
2 |
+
/shelf/
|
3 |
+
/workspace.xml
|
.idea/GorillaLLM.iml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<module type="PYTHON_MODULE" version="4">
|
3 |
+
<component name="NewModuleRootManager">
|
4 |
+
<content url="file://$MODULE_DIR$">
|
5 |
+
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
6 |
+
</content>
|
7 |
+
<orderEntry type="inheritedJdk" />
|
8 |
+
<orderEntry type="sourceFolder" forTests="false" />
|
9 |
+
</component>
|
10 |
+
</module>
|
.idea/inspectionProfiles/Project_Default.xml
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<component name="InspectionProjectProfileManager">
|
2 |
+
<profile version="1.0">
|
3 |
+
<option name="myName" value="Project Default" />
|
4 |
+
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
5 |
+
<option name="ignoredPackages">
|
6 |
+
<value>
|
7 |
+
<list size="85">
|
8 |
+
<item index="0" class="java.lang.String" itemvalue="greenlet" />
|
9 |
+
<item index="1" class="java.lang.String" itemvalue="networkx" />
|
10 |
+
<item index="2" class="java.lang.String" itemvalue="pygame" />
|
11 |
+
<item index="3" class="java.lang.String" itemvalue="python-dateutil" />
|
12 |
+
<item index="4" class="java.lang.String" itemvalue="SQLAlchemy" />
|
13 |
+
<item index="5" class="java.lang.String" itemvalue="h11" />
|
14 |
+
<item index="6" class="java.lang.String" itemvalue="MarkupSafe" />
|
15 |
+
<item index="7" class="java.lang.String" itemvalue="numpy" />
|
16 |
+
<item index="8" class="java.lang.String" itemvalue="Jinja2" />
|
17 |
+
<item index="9" class="java.lang.String" itemvalue="sniffio" />
|
18 |
+
<item index="10" class="java.lang.String" itemvalue="virtualenv-clone" />
|
19 |
+
<item index="11" class="java.lang.String" itemvalue="filelock" />
|
20 |
+
<item index="12" class="java.lang.String" itemvalue="starlette" />
|
21 |
+
<item index="13" class="java.lang.String" itemvalue="anyio" />
|
22 |
+
<item index="14" class="java.lang.String" itemvalue="xmltodict" />
|
23 |
+
<item index="15" class="java.lang.String" itemvalue="urllib3" />
|
24 |
+
<item index="16" class="java.lang.String" itemvalue="uvicorn" />
|
25 |
+
<item index="17" class="java.lang.String" itemvalue="itsdangerous" />
|
26 |
+
<item index="18" class="java.lang.String" itemvalue="pyparsing" />
|
27 |
+
<item index="19" class="java.lang.String" itemvalue="Flask" />
|
28 |
+
<item index="20" class="java.lang.String" itemvalue="scipy" />
|
29 |
+
<item index="21" class="java.lang.String" itemvalue="six" />
|
30 |
+
<item index="22" class="java.lang.String" itemvalue="Werkzeug" />
|
31 |
+
<item index="23" class="java.lang.String" itemvalue="kiwisolver" />
|
32 |
+
<item index="24" class="java.lang.String" itemvalue="packaging" />
|
33 |
+
<item index="25" class="java.lang.String" itemvalue="python-multipart" />
|
34 |
+
<item index="26" class="java.lang.String" itemvalue="gunicorn" />
|
35 |
+
<item index="27" class="java.lang.String" itemvalue="click" />
|
36 |
+
<item index="28" class="java.lang.String" itemvalue="Flask-SQLAlchemy" />
|
37 |
+
<item index="29" class="java.lang.String" itemvalue="pandas" />
|
38 |
+
<item index="30" class="java.lang.String" itemvalue="fonttools" />
|
39 |
+
<item index="31" class="java.lang.String" itemvalue="fastapi" />
|
40 |
+
<item index="32" class="java.lang.String" itemvalue="platformdirs" />
|
41 |
+
<item index="33" class="java.lang.String" itemvalue="colorama" />
|
42 |
+
<item index="34" class="java.lang.String" itemvalue="py-eureka-client" />
|
43 |
+
<item index="35" class="java.lang.String" itemvalue="matplotlib" />
|
44 |
+
<item index="36" class="java.lang.String" itemvalue="virtualenv" />
|
45 |
+
<item index="37" class="java.lang.String" itemvalue="charset-normalizer" />
|
46 |
+
<item index="38" class="java.lang.String" itemvalue="distlib" />
|
47 |
+
<item index="39" class="java.lang.String" itemvalue="ifaddr" />
|
48 |
+
<item index="40" class="java.lang.String" itemvalue="pytz" />
|
49 |
+
<item index="41" class="java.lang.String" itemvalue="fastapi-pagination" />
|
50 |
+
<item index="42" class="java.lang.String" itemvalue="idna" />
|
51 |
+
<item index="43" class="java.lang.String" itemvalue="Pillow" />
|
52 |
+
<item index="44" class="java.lang.String" itemvalue="eureka-client" />
|
53 |
+
<item index="45" class="java.lang.String" itemvalue="cryptography" />
|
54 |
+
<item index="46" class="java.lang.String" itemvalue="flask-eureka-client" />
|
55 |
+
<item index="47" class="java.lang.String" itemvalue="altgraph" />
|
56 |
+
<item index="48" class="java.lang.String" itemvalue="traitlets" />
|
57 |
+
<item index="49" class="java.lang.String" itemvalue="eureka" />
|
58 |
+
<item index="50" class="java.lang.String" itemvalue="pickleshare" />
|
59 |
+
<item index="51" class="java.lang.String" itemvalue="cffi" />
|
60 |
+
<item index="52" class="java.lang.String" itemvalue="wcwidth" />
|
61 |
+
<item index="53" class="java.lang.String" itemvalue="PyQt5-sip" />
|
62 |
+
<item index="54" class="java.lang.String" itemvalue="cycler" />
|
63 |
+
<item index="55" class="java.lang.String" itemvalue="executing" />
|
64 |
+
<item index="56" class="java.lang.String" itemvalue="pyasn1" />
|
65 |
+
<item index="57" class="java.lang.String" itemvalue="pycparser" />
|
66 |
+
<item index="58" class="java.lang.String" itemvalue="snowballstemmer" />
|
67 |
+
<item index="59" class="java.lang.String" itemvalue="PyQt5-Qt5" />
|
68 |
+
<item index="60" class="java.lang.String" itemvalue="tensorboard-plugin-wit" />
|
69 |
+
<item index="61" class="java.lang.String" itemvalue="Pygments" />
|
70 |
+
<item index="62" class="java.lang.String" itemvalue="PyQt5" />
|
71 |
+
<item index="63" class="java.lang.String" itemvalue="pywin32-ctypes" />
|
72 |
+
<item index="64" class="java.lang.String" itemvalue="pyinstaller" />
|
73 |
+
<item index="65" class="java.lang.String" itemvalue="tokenizers" />
|
74 |
+
<item index="66" class="java.lang.String" itemvalue="libclang" />
|
75 |
+
<item index="67" class="java.lang.String" itemvalue="dnspython" />
|
76 |
+
<item index="68" class="java.lang.String" itemvalue="pydantic" />
|
77 |
+
<item index="69" class="java.lang.String" itemvalue="wrapt" />
|
78 |
+
<item index="70" class="java.lang.String" itemvalue="Send2Trash" />
|
79 |
+
<item index="71" class="java.lang.String" itemvalue="torch" />
|
80 |
+
<item index="72" class="java.lang.String" itemvalue="contourpy" />
|
81 |
+
<item index="73" class="java.lang.String" itemvalue="pefile" />
|
82 |
+
<item index="74" class="java.lang.String" itemvalue="pyinstaller-hooks-contrib" />
|
83 |
+
<item index="75" class="java.lang.String" itemvalue="sortedcontainers" />
|
84 |
+
<item index="76" class="java.lang.String" itemvalue="tqdm" />
|
85 |
+
<item index="77" class="java.lang.String" itemvalue="flatbuffers" />
|
86 |
+
<item index="78" class="java.lang.String" itemvalue="pure-eval" />
|
87 |
+
<item index="79" class="java.lang.String" itemvalue="backcall" />
|
88 |
+
<item index="80" class="java.lang.String" itemvalue="future" />
|
89 |
+
<item index="81" class="java.lang.String" itemvalue="typing_extensions" />
|
90 |
+
<item index="82" class="java.lang.String" itemvalue="flask-eureka" />
|
91 |
+
<item index="83" class="java.lang.String" itemvalue="PyMySQL" />
|
92 |
+
<item index="84" class="java.lang.String" itemvalue="webencodings" />
|
93 |
+
</list>
|
94 |
+
</value>
|
95 |
+
</option>
|
96 |
+
</inspection_tool>
|
97 |
+
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
98 |
+
<option name="ignoredErrors">
|
99 |
+
<list>
|
100 |
+
<option value="N806" />
|
101 |
+
</list>
|
102 |
+
</option>
|
103 |
+
</inspection_tool>
|
104 |
+
</profile>
|
105 |
+
</component>
|
.idea/inspectionProfiles/profiles_settings.xml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<component name="InspectionProjectProfileManager">
|
2 |
+
<settings>
|
3 |
+
<option name="USE_PROJECT_PROFILE" value="false" />
|
4 |
+
<version value="1.0" />
|
5 |
+
</settings>
|
6 |
+
</component>
|
.idea/misc.xml
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (GorillaLLM)" project-jdk-type="Python SDK" />
|
4 |
+
</project>
|
.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="ProjectModuleManager">
|
4 |
+
<modules>
|
5 |
+
<module fileurl="file://$PROJECT_DIR$/.idea/GorillaLLM.iml" filepath="$PROJECT_DIR$/.idea/GorillaLLM.iml" />
|
6 |
+
</modules>
|
7 |
+
</component>
|
8 |
+
</project>
|
.idea/vcs.xml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="VcsDirectoryMappings">
|
4 |
+
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
5 |
+
</component>
|
6 |
+
</project>
|
LISCENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) [2023] [Anoop Johny]
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
Procfile
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
web: streamlit run main.py
|
generated_code_gorilla_7b_hf_v1.py
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
```python
|
4 |
+
def load_model():
|
5 |
+
return None
|
6 |
+
|
7 |
+
def process_data(numbers, model):
|
8 |
+
for num in numbers:
|
9 |
+
if model(num):
|
10 |
+
print(f"{num} is a prime number")
|
11 |
+
else:
|
12 |
+
print(f"{num} is not a prime number")
|
13 |
+
return None
|
14 |
+
|
15 |
+
numbers = range(1, 101)
|
16 |
+
model = True
|
17 |
+
|
18 |
+
# Load the model
|
19 |
+
load_model()
|
20 |
+
|
21 |
+
# Process the data
|
22 |
+
process_data(numbers, model)
|
23 |
+
```
|
24 |
+
|
25 |
+
The `load_model()` function is unnecessary and can be removed. The `process_data(numbers, model)` function takes in a `model` Boolean flag that indicates whether a number is prime or not. For each number in the range, the function calls `model(num)`, which returns a Boolean value indicating if the number is prime. If the number is prime, a print statement prints the number with the text "is a prime number". Otherwise, the number is not prime, and a print statement prints the number with the text "is not a prime number".
|
26 |
+
|
27 |
+
The code above can be simplified to the following:
|
28 |
+
|
29 |
+
```python
|
30 |
+
def process_data(model, numbers):
|
31 |
+
for num in
|
img.png
ADDED
![]() |
img_1.png
ADDED
![]() |
img_2.png
ADDED
![]() |
main.py
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import openai
|
2 |
+
import streamlit as st
|
3 |
+
import subprocess
|
4 |
+
|
5 |
+
# Initialize OpenAI API and server base
|
6 |
+
openai.api_key = "EMPTY"
|
7 |
+
openai.api_base = "http://zanino.millennium.berkeley.edu:8000/v1"
|
8 |
+
|
9 |
+
|
10 |
+
# Function to get response from Gorilla Server
|
11 |
+
def get_gorilla_response(prompt, model):
|
12 |
+
try:
|
13 |
+
# Create a chat completion using OpenAI API
|
14 |
+
completion = openai.ChatCompletion.create(
|
15 |
+
model=model,
|
16 |
+
messages=[{"role": "user", "content": prompt}]
|
17 |
+
)
|
18 |
+
print("Response: ", completion)
|
19 |
+
return completion.choices[0].message.content
|
20 |
+
except Exception as e:
|
21 |
+
print("An error occurred:", e)
|
22 |
+
|
23 |
+
|
24 |
+
# Function to extract code from output
|
25 |
+
def extract_code_from_output(output):
|
26 |
+
code = output.split("code>>>:")[1]
|
27 |
+
return code
|
28 |
+
|
29 |
+
|
30 |
+
# Function to execute generated code
|
31 |
+
def run_generated_code(file_path):
|
32 |
+
command = ["python", file_path]
|
33 |
+
try:
|
34 |
+
# Run the generated code as a subprocess
|
35 |
+
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
36 |
+
if result.returncode == 0:
|
37 |
+
st.success("Generated code executed successfully.")
|
38 |
+
st.code(result.stdout, language="python")
|
39 |
+
else:
|
40 |
+
st.error("Generated code execution failed:")
|
41 |
+
st.code(result.stderr, language="bash")
|
42 |
+
except Exception as e:
|
43 |
+
st.error("Error running generated code:", e)
|
44 |
+
|
45 |
+
|
46 |
+
# Set Streamlit layout
|
47 |
+
st.set_page_config(layout="wide")
|
48 |
+
|
49 |
+
|
50 |
+
# Main function
|
51 |
+
def main():
|
52 |
+
st.markdown(
|
53 |
+
"""
|
54 |
+
<style>
|
55 |
+
.center-image {
|
56 |
+
display: flex;
|
57 |
+
justify-content: center;
|
58 |
+
}
|
59 |
+
</style>
|
60 |
+
<a href="https://pythonpythonme.netlify.app/index.html">
|
61 |
+
<div class="center-image">
|
62 |
+
<img src="https://pythonpythonme.netlify.app/PythonPythonME.png" alt="Header image">
|
63 |
+
</div>
|
64 |
+
</a>
|
65 |
+
<p></p>
|
66 |
+
<p></p>
|
67 |
+
""",
|
68 |
+
unsafe_allow_html=True,
|
69 |
+
)
|
70 |
+
|
71 |
+
# Streamlit app title and input prompt
|
72 |
+
st.title("Gorilla LLM App 🦍🐒")
|
73 |
+
input_prompt = st.text_area("Enter User prompt:")
|
74 |
+
|
75 |
+
# Model selection dropdown
|
76 |
+
model_options = ('gorilla-7b-hf-v1', 'gorilla-mpt-7b-hf-v0')
|
77 |
+
option = st.selectbox('Select any model:', model_options)
|
78 |
+
|
79 |
+
# Button to trigger Gorilla Magic
|
80 |
+
if st.button("Generate"):
|
81 |
+
if len(input_prompt) > 0:
|
82 |
+
# Split app layout into two columns
|
83 |
+
col1, col2 = st.columns([1, 1])
|
84 |
+
|
85 |
+
# First column: Get Gorilla Server response
|
86 |
+
with col1:
|
87 |
+
result = get_gorilla_response(prompt=input_prompt, model=option)
|
88 |
+
st.write(result)
|
89 |
+
|
90 |
+
# Second column: Display generated code
|
91 |
+
with col2:
|
92 |
+
code_result = extract_code_from_output(result)
|
93 |
+
if option == "gorilla-7b-hf-v1":
|
94 |
+
st.subheader("Output Generated")
|
95 |
+
st.code(code_result, language='python')
|
96 |
+
elif option == "gorilla-mpt-7b-hf-v0":
|
97 |
+
lines = code_result.split('\\n')
|
98 |
+
for line in lines[:-1]:
|
99 |
+
st.code(line, language='python')
|
100 |
+
|
101 |
+
file_path = f"generated_code_{option.replace('-', '_')}.py"
|
102 |
+
with open(file_path, 'w') as file:
|
103 |
+
file.write(code_result)
|
104 |
+
run_generated_code(file_path)
|
105 |
+
|
106 |
+
st.markdown(
|
107 |
+
'''
|
108 |
+
<style>
|
109 |
+
.center-image {
|
110 |
+
display: flex;
|
111 |
+
justify-content: center;
|
112 |
+
}
|
113 |
+
.follow-me {
|
114 |
+
text-align: center;
|
115 |
+
}
|
116 |
+
.social-icons {
|
117 |
+
display: flex;
|
118 |
+
justify-content: center;
|
119 |
+
list-style: none;
|
120 |
+
padding: 0;
|
121 |
+
}
|
122 |
+
.social-icons li {
|
123 |
+
margin: 0 10px;
|
124 |
+
}
|
125 |
+
</style>
|
126 |
+
<body>
|
127 |
+
<div class="center-image">
|
128 |
+
<h4>Anoop Johny 🤖</h4>
|
129 |
+
</div>
|
130 |
+
<div class="center-image">
|
131 |
+
<h4>Follow Me</h4>
|
132 |
+
</div>
|
133 |
+
<div class="center-image">
|
134 |
+
<ul class="social-icons">
|
135 |
+
<li><a href="https://www.linkedin.com/in/anoop-johny-30a746181/"><img src="https://pythonpythonme.netlify.app/static/res/linkedin.png" width="55" height="55" alt="LinkedIn"></a></li>
|
136 |
+
<li><a href="https://github.com/flyfir248"><img src="https://pythonpythonme.netlify.app/static/res/github.png" width="55" height="55" alt="GitHub"></a></li>
|
137 |
+
<li><a href="https://pythonpythonme.netlify.app/index.html"><img src="https://pythonpythonme.netlify.app/static/res/web.png" width="55" height="55" alt="Website"></a></li>
|
138 |
+
<li><a href="https://medium.com/@anoopjohny2000"><img src="https://pythonpythonme.netlify.app/static/res/medium.png" width="55" height="55" alt="Medium"></a></li>
|
139 |
+
<li><a href="https://www.kooapp.com/profile/anoop2DEVLJ"><img src="https://www.kooapp.com/_next/static/media/logoKuSolidOutline.1f4fa971.svg" width="55" height="55" alt="The Koo App" width="55" height="55"></a></li>
|
140 |
+
</ul>
|
141 |
+
</div>
|
142 |
+
<footer class="footer">
|
143 |
+
<div class="container">
|
144 |
+
<div class="row">
|
145 |
+
<div class="center-image">
|
146 |
+
<p class="text-muted">© 2023-2024 PythonPythonME.</p>
|
147 |
+
<p>All rights reserved.</p>
|
148 |
+
</div>
|
149 |
+
</div>
|
150 |
+
</div>
|
151 |
+
</footer>
|
152 |
+
</body>
|
153 |
+
''',
|
154 |
+
unsafe_allow_html=True
|
155 |
+
)
|
156 |
+
|
157 |
+
if __name__ == '__main__':
|
158 |
+
main()
|
readme.md
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Gorilla LLM Demo App 🦍👤
|
2 |
+
|
3 |
+
This is a demo application showcasing the usage of OpenAI's language model (LLM) to interact with the Gorilla Server. The application utilizes Streamlit to create a user-friendly interface for generating and executing code based on user prompts.
|
4 |
+
|
5 |
+
## Overview
|
6 |
+
|
7 |
+
The Gorilla LLM Demo App is designed to:
|
8 |
+
- Interact with the Gorilla Server using OpenAI's language model.
|
9 |
+
- Generate code based on user prompts and selected model options.
|
10 |
+
- Execute the generated code and display the results using Streamlit's interface.
|
11 |
+
|
12 |
+
## Prerequisites
|
13 |
+
|
14 |
+
Before running the Gorilla LLM Demo App, you need to have the following installed:
|
15 |
+
- Python (3.6 or later)
|
16 |
+
- Pip (Python package installer)
|
17 |
+
|
18 |
+
## Installation
|
19 |
+
|
20 |
+
1. Clone this repository to your local machine:
|
21 |
+
|
22 |
+
```
|
23 |
+
git clone https://github.com/yourusername/gorilla-llm-demo.git
|
24 |
+
cd gorilla-llm-demo
|
25 |
+
```
|
26 |
+
|
27 |
+
1. Install the required dependencies:
|
28 |
+
```
|
29 |
+
pip install -r requirements.txt
|
30 |
+
```
|
31 |
+
|
32 |
+
## Usage
|
33 |
+
|
34 |
+
Make sure you have cloned the repository and installed the dependencies.
|
35 |
+
|
36 |
+
Run the Streamlit app:
|
37 |
+
```
|
38 |
+
streamlit run app.py
|
39 |
+
```
|
40 |
+
1. The application interface will open in a new browser tab. You will see the following sections:
|
41 |
+
- Enter your prompt: Type in the prompt you want to use to generate code.
|
42 |
+
- Select a model: Choose a model option from the dropdown list.
|
43 |
+
- Gorilla Magic button: Click this button to initiate the code generation process.
|
44 |
+
|
45 |
+
2. After clicking the "Gorilla Magic" button, the app will display the generated code and its execution result. The display will vary based on the selected model.
|
46 |
+
|
47 |
+
3. You can modify the prompt and model selection and repeat the process as needed.
|
48 |
+
|
49 |
+
Important Notes
|
50 |
+
|
51 |
+
* The application utilizes the OpenAI API and communicates with the Gorilla Server. Ensure you have the appropriate access and API key for both services.
|
52 |
+
* Be cautious when executing generated code, as it may have unintended consequences or security risks.
|
53 |
+
* This application is intended for demonstration purposes and should not be used in a production environment without careful consideration and testing.
|
54 |
+
|
55 |
+
Contributing
|
56 |
+
|
57 |
+
Contributions to the Gorilla LLM Demo App are welcome! If you find any issues or have suggestions for improvements, please feel free to submit a pull request or open an issue.
|
58 |
+
License
|
59 |
+
|
60 |
+
This project is licensed under the MIT License.
|
61 |
+
|
62 |
+
## Demonstration
|
63 |
+
|
64 |
+
### User Interface
|
65 |
+
1. User can enter a prompt and also choose the optional models provided by Gorilla
|
66 |
+

|
67 |
+
|
68 |
+
2. Sample User input
|
69 |
+

|
70 |
+
|
71 |
+
3. Output Code (this is a subprocess,stored and run in local enviroment)
|
72 |
+

|
73 |
+
|
74 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
openai
|
2 |
+
torch
|
3 |
+
transformers
|
4 |
+
gunicorn
|
5 |
+
streamlit
|
static/res/Icon.png
ADDED
![]() |
static/res/favicon.png
ADDED
![]() |
static/res/github.png
ADDED
![]() |
static/res/linkedin.png
ADDED
![]() |
static/res/medium.png
ADDED
![]() |
static/res/web.png
ADDED
![]() |
static/style.css
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
body {
|
2 |
+
background-color: #36393F;
|
3 |
+
color: #FFFFFF;
|
4 |
+
font-family: Arial, sans-serif;
|
5 |
+
margin: 0;
|
6 |
+
padding: 0;
|
7 |
+
}
|
8 |
+
|
9 |
+
.container {
|
10 |
+
width: 400px;
|
11 |
+
margin: 100px auto;
|
12 |
+
background-color: #2C2F33;
|
13 |
+
border-radius: 5px;
|
14 |
+
padding: 20px;
|
15 |
+
}
|
16 |
+
|
17 |
+
.header {
|
18 |
+
text-align: center;
|
19 |
+
margin-bottom: 20px;
|
20 |
+
}
|
21 |
+
|
22 |
+
.content {
|
23 |
+
display: flex;
|
24 |
+
flex-direction: column;
|
25 |
+
}
|
26 |
+
|
27 |
+
.form-group {
|
28 |
+
margin-bottom: 15px;
|
29 |
+
}
|
30 |
+
|
31 |
+
label {
|
32 |
+
display: block;
|
33 |
+
margin-bottom: 5px;
|
34 |
+
}
|
35 |
+
|
36 |
+
textarea {
|
37 |
+
width: 100%;
|
38 |
+
padding: 5px;
|
39 |
+
border: 1px solid #72767D;
|
40 |
+
border-radius: 3px;
|
41 |
+
background-color: #202225;
|
42 |
+
color: #FFFFFF;
|
43 |
+
}
|
44 |
+
|
45 |
+
.btn-submit {
|
46 |
+
width: 100%;
|
47 |
+
padding: 8px 0;
|
48 |
+
border: none;
|
49 |
+
border-radius: 3px;
|
50 |
+
background-color: #7289DA;
|
51 |
+
color: #FFFFFF;
|
52 |
+
cursor: pointer;
|
53 |
+
}
|
54 |
+
|
55 |
+
.result {
|
56 |
+
margin-top: 10px;
|
57 |
+
}
|
58 |
+
|
59 |
+
.sentiment-result {
|
60 |
+
font-size: 15px;
|
61 |
+
margin-top: 5px;
|
62 |
+
}
|
63 |
+
|
64 |
+
.positive {
|
65 |
+
color: #03fc1c;
|
66 |
+
font-weight: bold;
|
67 |
+
}
|
68 |
+
|
69 |
+
.negative {
|
70 |
+
color: #ff050d;
|
71 |
+
font-weight: bold;
|
72 |
+
}
|
73 |
+
|
74 |
+
.neutral {
|
75 |
+
color: #f2f8fc;
|
76 |
+
}
|