PierreBrunelle
commited on
Commit
•
53916a8
1
Parent(s):
fb3b5a9
Update app.py
Browse files
app.py
CHANGED
@@ -52,12 +52,12 @@ def create_prompt(top_k_list: list[dict], question: str) -> str:
|
|
52 |
|
53 |
"""Gradio Application"""
|
54 |
|
55 |
-
def process_files(ground_truth_file, pdf_files):
|
56 |
# Process ground truth file
|
57 |
if ground_truth_file.name.endswith('.csv'):
|
58 |
-
queries_t = pxt.io.import_csv(rag_demo.queries, ground_truth_file.name)
|
59 |
else:
|
60 |
-
queries_t = pxt.io.import_excel(rag_demo.queries, ground_truth_file.name)
|
61 |
|
62 |
# Process PDF files
|
63 |
documents_t = pxt.create_table(
|
@@ -110,11 +110,7 @@ def process_files(ground_truth_file, pdf_files):
|
|
110 |
}
|
111 |
]
|
112 |
|
113 |
-
def query_llm(question
|
114 |
-
queries_t = pxt.get_table('rag_demo.queries')
|
115 |
-
chunks_t = pxt.get_table('rag_demo.chunks')
|
116 |
-
|
117 |
-
|
118 |
|
119 |
# Add OpenAI response column
|
120 |
queries_t['response'] = openai.chat_completions(
|
@@ -173,5 +169,4 @@ with gr.Blocks() as demo:
|
|
173 |
query_button.click(query_llm, inputs=question_input, outputs=output_dataframe)
|
174 |
|
175 |
if __name__ == "__main__":
|
176 |
-
demo.launch()
|
177 |
-
|
|
|
52 |
|
53 |
"""Gradio Application"""
|
54 |
|
55 |
+
def process_files(ground_truth_file, pdf_files):
|
56 |
# Process ground truth file
|
57 |
if ground_truth_file.name.endswith('.csv'):
|
58 |
+
queries_t = pxt.io.import_csv('rag_demo.queries', ground_truth_file.name)
|
59 |
else:
|
60 |
+
queries_t = pxt.io.import_excel('rag_demo.queries', ground_truth_file.name)
|
61 |
|
62 |
# Process PDF files
|
63 |
documents_t = pxt.create_table(
|
|
|
110 |
}
|
111 |
]
|
112 |
|
113 |
+
def query_llm(question):
|
|
|
|
|
|
|
|
|
114 |
|
115 |
# Add OpenAI response column
|
116 |
queries_t['response'] = openai.chat_completions(
|
|
|
169 |
query_button.click(query_llm, inputs=question_input, outputs=output_dataframe)
|
170 |
|
171 |
if __name__ == "__main__":
|
172 |
+
demo.launch()
|
|