Spaces:
Runtime error
Runtime error
LOUIS SANNA
commited on
Commit
•
a50da00
1
Parent(s):
2874cff
feat(docs): explain var env
Browse files- README.md +23 -4
- example.env +8 -0
README.md
CHANGED
@@ -18,13 +18,21 @@ This tool serves as a customizable version of the amazing ClimateQA by Ekimetric
|
|
18 |
0. **Fork the Repository**
|
19 |
Fork the original HuggingFace space: [Anything Q&A on HuggingFace](https://huggingface.co/spaces/LouisSanna/anything-question-answering).
|
20 |
|
21 |
-
1. **
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
```shell
|
24 |
pip install -r requirements.txt
|
25 |
```
|
26 |
|
27 |
-
|
28 |
Place the PDFs to be used as sources in the data folder. The subfolder and file names will be used as default identifiers by the tool.
|
29 |
|
30 |
```txt
|
@@ -36,13 +44,13 @@ This tool serves as a customizable version of the amazing ClimateQA by Ekimetric
|
|
36 |
source_3.pdf
|
37 |
```
|
38 |
|
39 |
-
|
40 |
|
41 |
```bash
|
42 |
python -m anyqa.build_index
|
43 |
```
|
44 |
|
45 |
-
|
46 |
|
47 |
```shell
|
48 |
python app.py
|
@@ -53,3 +61,14 @@ And you're done!
|
|
53 |
## Deployment
|
54 |
|
55 |
Deploying via Hugging Face Spaces is the most straightforward approach. Simply push your code to a HuggingFace Gradio space, and it will function as is.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
0. **Fork the Repository**
|
19 |
Fork the original HuggingFace space: [Anything Q&A on HuggingFace](https://huggingface.co/spaces/LouisSanna/anything-question-answering).
|
20 |
|
21 |
+
1. **Set environment variables**
|
22 |
+
|
23 |
+
For OpenAI API:
|
24 |
+
|
25 |
+
```env
|
26 |
+
OPENAI_API_KEY=...
|
27 |
+
```
|
28 |
+
|
29 |
+
2. **Install Dependencies**
|
30 |
|
31 |
```shell
|
32 |
pip install -r requirements.txt
|
33 |
```
|
34 |
|
35 |
+
3. **Add your data.**
|
36 |
Place the PDFs to be used as sources in the data folder. The subfolder and file names will be used as default identifiers by the tool.
|
37 |
|
38 |
```txt
|
|
|
44 |
source_3.pdf
|
45 |
```
|
46 |
|
47 |
+
4. **Build the index of semantic vectors**
|
48 |
|
49 |
```bash
|
50 |
python -m anyqa.build_index
|
51 |
```
|
52 |
|
53 |
+
5. **Launch the app**
|
54 |
|
55 |
```shell
|
56 |
python app.py
|
|
|
61 |
## Deployment
|
62 |
|
63 |
Deploying via Hugging Face Spaces is the most straightforward approach. Simply push your code to a HuggingFace Gradio space, and it will function as is.
|
64 |
+
|
65 |
+
You will need to set the environments variables in the settings.
|
66 |
+
|
67 |
+
## AI providers
|
68 |
+
|
69 |
+
The following providers are currently supported:
|
70 |
+
|
71 |
+
- OpenAI
|
72 |
+
- Azure OpenAI
|
73 |
+
|
74 |
+
The provider is picked based on the variable variables, see `example.env`.
|
example.env
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# To use OpenAI API
|
2 |
+
OPENAI_API_KEY=...
|
3 |
+
|
4 |
+
# To use Azure OpenAI API
|
5 |
+
# AZURE_OPENAI_API_BASE_URL=
|
6 |
+
# AZURE_OPENAI_API_VERSION=
|
7 |
+
# AZURE_OPENAI_API_DEPLOYMENT_NAME=
|
8 |
+
# AZURE_OPENAI_API_KEY=
|