zaldivards commited on
Commit
f713e02
·
1 Parent(s): f66e4f3

docs: add a little guide on the readme

Browse files
README.md CHANGED
@@ -8,7 +8,11 @@ sdk_version: 4.42.0
8
  app_file: app.py
9
  pinned: false
10
  ---
11
- # ContextqaSV tool
 
 
 
 
12
 
13
  HuggingChat tool for querying law documents from El Salvador. This is a forked and customized version of the [RAG community template](https://huggingface.co/spaces/nsarrazin/rag-tool-template/tree/main)
14
 
@@ -22,5 +26,28 @@ HuggingChat tool for querying law documents from El Salvador. This is a forked a
22
  * Typed functions.
23
  * Simplified existing functions.
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  ### Contact
26
- For inquiries, contributions, or feedback, please contact [me](mailto:[email protected]). Visit my [github account](https://github.com/zaldivards) and check out my other projects :)
 
 
8
  app_file: app.py
9
  pinned: false
10
  ---
11
+ <p align="center">
12
+ <img src="assets/contextqasv-logo.png" alt="Imagen" width="200" style="display: inline-block; vertical-align: middle;">
13
+ </p>
14
+
15
+ # ContextqaSV
16
 
17
  HuggingChat tool for querying law documents from El Salvador. This is a forked and customized version of the [RAG community template](https://huggingface.co/spaces/nsarrazin/rag-tool-template/tree/main)
18
 
 
26
  * Typed functions.
27
  * Simplified existing functions.
28
 
29
+ ## How to use?
30
+
31
+ On the [HuggingChat](https://huggingface.co/chat/) site, follow the next steps:
32
+
33
+ Click the *Browse more tools* button:
34
+
35
+ ![Brose more tools ss](assets/contextqasv-ss1.png)
36
+
37
+ Start typing in the search box and click on the **ContextqaSV** tool:
38
+
39
+ ![search and select it ss](assets/contextqasv-ss2.png)
40
+
41
+ Click on the *Activate* button:
42
+
43
+ ![activate ss](assets/contextqasv-ss3.png)
44
+
45
+ You're all set! You can now start asking questions about El Salvador's constitution and its traffic regulations:
46
+
47
+ ![start ss](assets/contextqasv-ss4.png)
48
+
49
+ Note that you can use the [tool's URL](https://hf.co/chat/tools/67a7a96e127c6ef860bce266) to be redirected to HuggingChat and directly show the tool card to activate it (3rd step)
50
+
51
  ### Contact
52
+
53
+ For inquiries, contributions, or feedback, please contact [me](mailto:[email protected]). Visit my [github account](https://github.com/zaldivards) and check out my other projects :)
app.py CHANGED
@@ -54,17 +54,7 @@ def convert(filename: str) -> str:
54
  ValueError
55
  If the file type is not supported.
56
  """
57
- plain_text_filetypes = [
58
- ".txt",
59
- ".csv",
60
- ".tsv",
61
- ".md",
62
- ".yaml",
63
- ".toml",
64
- ".json",
65
- ".json5",
66
- ".jsonc",
67
- ]
68
  # Already a plain text file that wouldn't benefit from pandoc so return the content
69
  if any(filename.endswith(ft) for ft in plain_text_filetypes):
70
  with open(filename, "r", encoding="utf-8") as f:
@@ -185,10 +175,11 @@ init()
185
  gr.Interface(
186
  predict,
187
  inputs=[
188
- gr.Textbox(label="Query asked about the documents"),
189
- gr.Number(label="Number of relevant sources returned (k)", value=default_k),
190
  ],
191
  outputs=[gr.Text(label="Relevant chunks")],
192
- title="ContextQA tool - El Salvador",
193
- description="Forked and customized RAG tool working with law documents from El Salvador",
 
194
  ).launch()
 
54
  ValueError
55
  If the file type is not supported.
56
  """
57
+ plain_text_filetypes = [".txt", ".csv", ".tsv", ".md", ".yaml", ".toml", ".json", ".json5", ".jsonc"]
 
 
 
 
 
 
 
 
 
 
58
  # Already a plain text file that wouldn't benefit from pandoc so return the content
59
  if any(filename.endswith(ft) for ft in plain_text_filetypes):
60
  with open(filename, "r", encoding="utf-8") as f:
 
175
  gr.Interface(
176
  predict,
177
  inputs=[
178
+ gr.Textbox(label="Question asked about the documents"),
179
+ gr.Number(label="Number of relevant sources to return (k)", value=default_k),
180
  ],
181
  outputs=[gr.Text(label="Relevant chunks")],
182
+ title="ContextqaSV",
183
+ description="RAG tool enabling questions and answers on legal documents from El Salvador. Legal"
184
+ " documents supported:\n- Constitución de la república\n- Reglamento de tránsito y seguridad vial",
185
  ).launch()
assets/contextqasv-logo.png ADDED
assets/contextqasv-ss1.png ADDED
assets/contextqasv-ss2.png ADDED
assets/contextqasv-ss3.png ADDED
assets/contextqasv-ss4.png ADDED