Spaces:
Runtime error
Runtime error
LennardZuendorf
commited on
chore: updating readme and config,cleanup
Browse files- .gitignore +1 -0
- .idea/thesis-webapp.iml +0 -1
- README.md +42 -3
- backend/database.py +0 -0
- backend/db.json +0 -0
- main.py +15 -6
.gitignore
CHANGED
@@ -2,3 +2,4 @@
|
|
2 |
__pycache__/
|
3 |
/start-venv.sh
|
4 |
/components/iframe/dist/
|
|
|
|
2 |
__pycache__/
|
3 |
/start-venv.sh
|
4 |
/components/iframe/dist/
|
5 |
+
/components/
|
.idea/thesis-webapp.iml
CHANGED
@@ -6,7 +6,6 @@
|
|
6 |
<sourceFolder url="file://$MODULE_DIR$/components/shap-plots/backend" isTestSource="false" />
|
7 |
<sourceFolder url="file://$MODULE_DIR$/components/shap/backend" isTestSource="false" />
|
8 |
<sourceFolder url="file://$MODULE_DIR$/components/visualizer/backend" isTestSource="false" />
|
9 |
-
<sourceFolder url="file://$MODULE_DIR$/components/iframe/backend" isTestSource="false" />
|
10 |
</content>
|
11 |
<orderEntry type="jdk" jdkName="Python 3.11.6 WSL (Ubuntu): (/home/lennard/.virtualenvs/thesis/bin/python)" jdkType="Python SDK" />
|
12 |
<orderEntry type="sourceFolder" forTests="false" />
|
|
|
6 |
<sourceFolder url="file://$MODULE_DIR$/components/shap-plots/backend" isTestSource="false" />
|
7 |
<sourceFolder url="file://$MODULE_DIR$/components/shap/backend" isTestSource="false" />
|
8 |
<sourceFolder url="file://$MODULE_DIR$/components/visualizer/backend" isTestSource="false" />
|
|
|
9 |
</content>
|
10 |
<orderEntry type="jdk" jdkName="Python 3.11.6 WSL (Ubuntu): (/home/lennard/.virtualenvs/thesis/bin/python)" jdkType="Python SDK" />
|
11 |
<orderEntry type="sourceFolder" forTests="false" />
|
README.md
CHANGED
@@ -25,19 +25,60 @@ This is the ui showcase for my thesis about interpretability in a LLM based chat
|
|
25 |
|
26 |
**[Huggingface Spaces Showcase](https://huggingface.co/spaces/lennardzuendorf/thesis-webapp-docker)**
|
27 |
|
|
|
|
|
28 |
### 🏗️ Tech Stack:
|
29 |
|
30 |
**Language and Framework:** Python
|
31 |
|
32 |
**Noteable Packages:** 🤗 Transformers, FastAPI, Gradio, SHAP, BERTViz
|
33 |
|
34 |
-
## 👨💻 Author
|
35 |
|
36 |
**Author: [@LennardZuendorf](https://github.com/LennardZuendorf)**
|
37 |
|
38 |
**Thesis Supervisor: [Prof. Dr. Simbeck](https://www.htw-berlin.de/hochschule/personen/person/?eid=9862)**
|
39 |
<br> Second Corrector: [Prof. Dr. Hochstein](https://www.htw-berlin.de/hochschule/personen/person/?eid=10628)
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
See code for in detailed credits, work is strongly based on:
|
42 |
#### GODEL
|
43 |
- [HGF Model Page](https://huggingface.co/microsoft/GODEL-v1_1-large-seq2seq?text=Hey+my+name+is+Mariama%21+How+are+you%3F)
|
@@ -47,5 +88,3 @@ See code for in detailed credits, work is strongly based on:
|
|
47 |
#### SHAP
|
48 |
- [Github](https://github.com/shap/shap)
|
49 |
- [Inital Paper](https://arxiv.org/abs/1705.07874)
|
50 |
-
|
51 |
-
This Project was part of my studies of Business Computing at University of Applied Science for Technology and Business Berlin (HTW Berlin).
|
|
|
25 |
|
26 |
**[Huggingface Spaces Showcase](https://huggingface.co/spaces/lennardzuendorf/thesis-webapp-docker)**
|
27 |
|
28 |
+
**[Non-Public Showcase]()**
|
29 |
+
|
30 |
### 🏗️ Tech Stack:
|
31 |
|
32 |
**Language and Framework:** Python
|
33 |
|
34 |
**Noteable Packages:** 🤗 Transformers, FastAPI, Gradio, SHAP, BERTViz
|
35 |
|
36 |
+
## 👨💻 Author:
|
37 |
|
38 |
**Author: [@LennardZuendorf](https://github.com/LennardZuendorf)**
|
39 |
|
40 |
**Thesis Supervisor: [Prof. Dr. Simbeck](https://www.htw-berlin.de/hochschule/personen/person/?eid=9862)**
|
41 |
<br> Second Corrector: [Prof. Dr. Hochstein](https://www.htw-berlin.de/hochschule/personen/person/?eid=10628)
|
42 |
|
43 |
+
This Project was part of my studies of Business Computing at University of Applied Science for Technology and Business Berlin (HTW Berlin).
|
44 |
+
|
45 |
+
## Running the Project:
|
46 |
+
|
47 |
+
### 🐍 Python:
|
48 |
+
|
49 |
+
(This assumes you have set up a python environment, I recommend using a virtual environment.)
|
50 |
+
|
51 |
+
1. Clone the repository using git or GitHub cli.
|
52 |
+
2. Start the (virtual) environment.
|
53 |
+
3. Install the requirements using `pip install -r requirements.txt`
|
54 |
+
4. Run the app using `uvicorn main:app`. You can add `--reload` to enable hot reloading. The app will be available at `localhost:8000`.
|
55 |
+
|
56 |
+
### 🐳 Dockerfile:
|
57 |
+
|
58 |
+
(This assumes you have set up docker desktop or are using a hosting service able to handle Dockerfiles.)
|
59 |
+
|
60 |
+
1. Clone the repository using git or GitHub cli.
|
61 |
+
2. Build the docker image using `docker build -t thesis-webapp .`, the command commented in the docker file or the command referenced by your hosting service.
|
62 |
+
3. Run the docker image using `docker run -p 8080:8080 thesis-webapp`, the command commented in the docker file or the command referenced by your hosting service.
|
63 |
+
4. The app will be available at `localhost:8080`. If you are using a hosting service, the port may be different.
|
64 |
+
|
65 |
+
### 🐳 Docker Image:
|
66 |
+
|
67 |
+
(This assumes you have set up docker desktop or are using a hosting service able to handle Docker images.)
|
68 |
+
|
69 |
+
1. Pull the docker image from ghcr using `docker pull ghcr.io/LennardZuendorf/thesis-webapp:latest`.
|
70 |
+
2. Run the docker image using `docker run -p 8080:8080 lennardzuendorf/thesis-webapp:latest`, the command commented in the docker file or the command referenced by your hosting service.
|
71 |
+
3. The app will be available at `localhost:8080`. If you are using a hosting service, the port may be different.
|
72 |
+
|
73 |
+
## 📝 License and Credits:
|
74 |
+
|
75 |
+
This project is licensed under the MIT License, see [LICENSE](LICENSE.md) for more information. Please cite this project, it's author and my university if you use it in your work.
|
76 |
+
|
77 |
+
- Title: Building an Interpretable Natural Language AI Tool based on Transformer Models and approaches of Explainable AI.
|
78 |
+
- Date: 2024-01-27
|
79 |
+
- Author: Lennard Zündorf
|
80 |
+
- University: HTW Berlin
|
81 |
+
|
82 |
See code for in detailed credits, work is strongly based on:
|
83 |
#### GODEL
|
84 |
- [HGF Model Page](https://huggingface.co/microsoft/GODEL-v1_1-large-seq2seq?text=Hey+my+name+is+Mariama%21+How+are+you%3F)
|
|
|
88 |
#### SHAP
|
89 |
- [Github](https://github.com/shap/shap)
|
90 |
- [Inital Paper](https://arxiv.org/abs/1705.07874)
|
|
|
|
backend/database.py
DELETED
File without changes
|
backend/db.json
DELETED
File without changes
|
main.py
CHANGED
@@ -16,7 +16,18 @@ from explanation.markup import color_codes
|
|
16 |
|
17 |
# Global Variables and css
|
18 |
app = FastAPI()
|
19 |
-
css = "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
coloring = color_codes()
|
21 |
|
22 |
|
@@ -48,10 +59,8 @@ def xai_info(xai_radio):
|
|
48 |
# ui interface based on Gradio Blocks (see documentation:
|
49 |
# https://www.gradio.app/docs/interface)
|
50 |
with gr.Blocks(
|
51 |
-
css=
|
52 |
-
|
53 |
-
.seperatedRow {border-top: 1rem solid;}",
|
54 |
-
""",
|
55 |
title="Thesis Webapp Showcase",
|
56 |
head="<head>",
|
57 |
) as ui:
|
@@ -203,8 +212,8 @@ with gr.Blocks(
|
|
203 |
'<div style="text-align: center; font-family:arial;"><h4>No Graphic'
|
204 |
" to Display (Yet)</h4></div>"
|
205 |
),
|
206 |
-
height="1000px",
|
207 |
show_label=True,
|
|
|
208 |
)
|
209 |
|
210 |
# functions to trigger the controller
|
|
|
16 |
|
17 |
# Global Variables and css
|
18 |
app = FastAPI()
|
19 |
+
css = """
|
20 |
+
.examples {text-align: start;}
|
21 |
+
.seperatedRow {border-top: 1rem solid;}",
|
22 |
+
"""
|
23 |
+
js = """
|
24 |
+
function () {
|
25 |
+
gradioURL = window.location.href
|
26 |
+
if (!gradioURL.endsWith('?__theme=light')) {
|
27 |
+
window.location.replace(gradioURL + '?__theme=light');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
"""
|
31 |
coloring = color_codes()
|
32 |
|
33 |
|
|
|
59 |
# ui interface based on Gradio Blocks (see documentation:
|
60 |
# https://www.gradio.app/docs/interface)
|
61 |
with gr.Blocks(
|
62 |
+
css=css,
|
63 |
+
js=js,
|
|
|
|
|
64 |
title="Thesis Webapp Showcase",
|
65 |
head="<head>",
|
66 |
) as ui:
|
|
|
212 |
'<div style="text-align: center; font-family:arial;"><h4>No Graphic'
|
213 |
" to Display (Yet)</h4></div>"
|
214 |
),
|
|
|
215 |
show_label=True,
|
216 |
+
height="400px",
|
217 |
)
|
218 |
|
219 |
# functions to trigger the controller
|