Spaces:
Sleeping
Sleeping
adding application
Browse files
app.py
CHANGED
@@ -240,7 +240,7 @@ def find_last_token_index(full_ids, word_ids):
|
|
240 |
return None
|
241 |
|
242 |
@GPU # this block runs on a job GPU
|
243 |
-
def analyse_word(model_name: str,
|
244 |
try:
|
245 |
model, tokenizer = get_model_and_tokenizer(model_name)
|
246 |
|
@@ -304,10 +304,6 @@ with gr.Blocks(theme="soft") as demo:
|
|
304 |
choices=[DEFAULT_MODEL, "mistralai/Mistral-7B-v0.1", "meta-llama/Llama-2-7b", "Qwen/Qwen2-7B"],
|
305 |
value=DEFAULT_MODEL,
|
306 |
)
|
307 |
-
extraction_template = gr.Textbox(
|
308 |
-
label="Extraction prompt (use X as placeholder)",
|
309 |
-
value="repeat the following word X twice: 1)X 2)",
|
310 |
-
)
|
311 |
patchscopes_template = gr.Textbox(
|
312 |
label="Patchscopes prompt (use X as placeholder)",
|
313 |
value="repeat the following word X twice: 1)X 2)",
|
@@ -318,7 +314,7 @@ with gr.Blocks(theme="soft") as demo:
|
|
318 |
|
319 |
run_btn.click(
|
320 |
analyse_word,
|
321 |
-
inputs=[model_name,
|
322 |
outputs=out_html,
|
323 |
)
|
324 |
|
|
|
240 |
return None
|
241 |
|
242 |
@GPU # this block runs on a job GPU
|
243 |
+
def analyse_word(model_name: str, word: str, patchscopes_template: str):
|
244 |
try:
|
245 |
model, tokenizer = get_model_and_tokenizer(model_name)
|
246 |
|
|
|
304 |
choices=[DEFAULT_MODEL, "mistralai/Mistral-7B-v0.1", "meta-llama/Llama-2-7b", "Qwen/Qwen2-7B"],
|
305 |
value=DEFAULT_MODEL,
|
306 |
)
|
|
|
|
|
|
|
|
|
307 |
patchscopes_template = gr.Textbox(
|
308 |
label="Patchscopes prompt (use X as placeholder)",
|
309 |
value="repeat the following word X twice: 1)X 2)",
|
|
|
314 |
|
315 |
run_btn.click(
|
316 |
analyse_word,
|
317 |
+
inputs=[model_name, word_box, patchscopes_template],
|
318 |
outputs=out_html,
|
319 |
)
|
320 |
|