import gradio as gr import pandas as pd from load_data import * import os hf_writer = gr.HuggingFaceDatasetSaver('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', "Pavankalyan/chitti_data") def chitti(query): ''' re_table = search(query) answers_re_table = [re_table[i][0] for i in range(0,5)] answer_links = [re_table[i][3] for i in range(0,5)] sorted_indices = sorted(range(len(answers_re_table)), key=lambda k: len(answers_re_table[k])) repeated_answers_indices =list() for i in range(4): if answers_re_table[sorted_indices[i]] in answers_re_table[sorted_indices[i+1]]: repeated_answers_indices.append(sorted_indices[i]) for idx in repeated_answers_indices: answers_re_table.pop(idx) answer_links.pop(idx) #return [res1,answers_re_table[0],res2,answers_re_table[1]] #return [answers_re_table[0],answers_links[0],answers_re_table[1],answer_links[1]]''' return [str(os.getcwd())] demo = gr.Interface( fn=chitti, inputs=["text"], #outputs=["text","text","text","text"], outputs=["text"], allow_flagging = "manual", flagging_options = ["0","1","None"], flagging_callback=hf_writer ) demo.launch()