julien-c HF staff commited on
Commit
bdbadf6
1 Parent(s): 9c58cdd
Files changed (4) hide show
  1. .gitignore +1 -0
  2. .vscode/settings.json +2 -1
  3. README.md +1 -1
  4. app.py +5 -2
.gitignore CHANGED
@@ -1 +1,2 @@
1
  .env/
 
 
1
  .env/
2
+ dev.env
.vscode/settings.json CHANGED
@@ -2,5 +2,6 @@
2
  "[python]": {
3
  "editor.defaultFormatter": "ms-python.black-formatter"
4
  },
5
- "editor.formatOnSave": true
 
6
  }
 
2
  "[python]": {
3
  "editor.defaultFormatter": "ms-python.black-formatter"
4
  },
5
+ "editor.formatOnSave": true,
6
+ "python.envFile": "${workspaceFolder}/dev.env"
7
  }
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🚀
4
  colorFrom: blue
5
  colorTo: gray
6
  sdk: gradio
7
- sdk_version: 4.37.1
8
  app_file: app.py
9
  pinned: false
10
  ---
 
4
  colorFrom: blue
5
  colorTo: gray
6
  sdk: gradio
7
+ sdk_version: 4.43.0
8
  app_file: app.py
9
  pinned: false
10
  ---
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import time
2
  import os
 
3
  import gradio as gr
4
  import torch
5
  from transformers import AutoModel, AutoTokenizer
@@ -22,7 +23,9 @@ meilisearch_index = meilisearch_client.index(meilisearch_index_name)
22
  output_options = ["RAG-friendly", "human-friendly"]
23
 
24
 
25
- def search_embeddings(query_text, output_option):
 
 
26
  start_time_embedding = time.time()
27
  query_prefix = "Represent this sentence for searching code documentation: "
28
  query_tokens = tokenizer(
@@ -99,7 +102,7 @@ demo = gr.Interface(
99
  ),
100
  ],
101
  outputs=[gr.Markdown(), gr.Markdown()],
102
- title="HF Docs Emebddings Explorer",
103
  allow_flagging="never",
104
  )
105
 
 
1
  import time
2
  import os
3
+ from typing import Literal, Tuple
4
  import gradio as gr
5
  import torch
6
  from transformers import AutoModel, AutoTokenizer
 
23
  output_options = ["RAG-friendly", "human-friendly"]
24
 
25
 
26
+ def search_embeddings(
27
+ query_text: str, output_option: Literal["RAG-friendly", "human-friendly"]
28
+ ) -> Tuple[str, str]:
29
  start_time_embedding = time.time()
30
  query_prefix = "Represent this sentence for searching code documentation: "
31
  query_tokens = tokenizer(
 
102
  ),
103
  ],
104
  outputs=[gr.Markdown(), gr.Markdown()],
105
+ title="HF Docs Embeddings Explorer",
106
  allow_flagging="never",
107
  )
108