Chitti_ver1 / app.py
Pavankalyan's picture
Update app.py
a50b133
raw
history blame
697 Bytes
import gradio as gr
import pandas as pd
from retrieval import *
import os
hf_writer = gr.HuggingFaceDatasetSaver('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', "Pavankalyan/chitti_data")
df = pd.read_csv("Responses.csv")
text = list(df["text"].values)
def chitti(query):
re_table = search(query, text)
with open(query[0:5]+'.txt', 'w') as f:
f.writelines(["Question: "+query,"Ans 1 : "+ re_table[0][0],"Ans 2 : "+ re_table[1][0]])
return [re_table[0][0],re_table[1][0]]
demo = gr.Interface(
fn=chitti,
inputs=["text"],
outputs=["text","text"],
allow_flagging = "manual",
flagging_options = ["0","1","None"],
flagging_callback=hf_writer
)
demo.launch()