Spaces:
Sleeping
Sleeping
Commit
·
51a0cf8
1
Parent(s):
3bdf307
deleted non-flagged logs
Browse files
app.py
CHANGED
@@ -14,10 +14,6 @@ data = prepare_data()
|
|
14 |
HF_TOKEN = os.getenv('HF_TOKEN')
|
15 |
hf_writer = gr.HuggingFaceDatasetSaver(HF_TOKEN, "budu_search_data_new")
|
16 |
|
17 |
-
new = Dataset.from_dict({'Введите запрос':['тест'],
|
18 |
-
'output':['тест']},split='train')
|
19 |
-
new.push_to_hub("etadevosyan/not_flagged_data",
|
20 |
-
token=HF_TOKEN)
|
21 |
#%%
|
22 |
def search_handler(query: str):
|
23 |
results, exact_results = (
|
@@ -33,16 +29,8 @@ def create_ui(query):
|
|
33 |
results = search_handler(query)
|
34 |
for result in results['results'][:5]:
|
35 |
recommendations.append(f"<div style='padding: 10px; border-bottom: 1px solid #ddd;'>{result['name']}</div>")
|
36 |
-
log_non_flagged_queries(query,recommendations)
|
37 |
return gr.HTML(f"<div style='max-height: 400px; overflow-y: auto;'>{''.join(recommendations)}</div>")
|
38 |
|
39 |
-
def log_non_flagged_queries(query,recommendations):
|
40 |
-
dataset = load_dataset('etadevosyan/not_flagged_data')
|
41 |
-
dataset['train'].add_item({'Введите запрос':query,
|
42 |
-
'output':recommendations})
|
43 |
-
dataset.push_to_hub("etadevosyan/not_flagged_data",
|
44 |
-
token=HF_TOKEN)
|
45 |
-
|
46 |
iface = gr.Interface(
|
47 |
fn=create_ui,
|
48 |
inputs=gr.Textbox(label="Введите запрос"),
|
|
|
14 |
HF_TOKEN = os.getenv('HF_TOKEN')
|
15 |
hf_writer = gr.HuggingFaceDatasetSaver(HF_TOKEN, "budu_search_data_new")
|
16 |
|
|
|
|
|
|
|
|
|
17 |
#%%
|
18 |
def search_handler(query: str):
|
19 |
results, exact_results = (
|
|
|
29 |
results = search_handler(query)
|
30 |
for result in results['results'][:5]:
|
31 |
recommendations.append(f"<div style='padding: 10px; border-bottom: 1px solid #ddd;'>{result['name']}</div>")
|
|
|
32 |
return gr.HTML(f"<div style='max-height: 400px; overflow-y: auto;'>{''.join(recommendations)}</div>")
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
iface = gr.Interface(
|
35 |
fn=create_ui,
|
36 |
inputs=gr.Textbox(label="Введите запрос"),
|