Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,7 +34,6 @@ def process_pdf(pdf_path):
|
|
| 34 |
|
| 35 |
# RAG Query Function
|
| 36 |
def query_rag(message, temperature, max_new_tokens, top_k, repetition_penalty, top_p, system_prompt, history=None):
|
| 37 |
-
|
| 38 |
if vector_store is None:
|
| 39 |
return "Please upload and process a PDF first."
|
| 40 |
|
|
@@ -81,14 +80,13 @@ def launch_interface():
|
|
| 81 |
process_btn = gr.Button("Process PDF")
|
| 82 |
process_output = gr.Textbox(label="Processing Status", interactive=False)
|
| 83 |
|
| 84 |
-
chatbot = gr.ChatInterface(
|
| 85 |
-
lambda message: query_rag(message, 0.7, 10000, 40, 1.1, 0.95, "You are a helpful assistant."),
|
| 86 |
-
)
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
process_btn.click(process_pdf, inputs=[pdf_uploader], outputs=[process_output])
|
| 91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
demo.launch(share=True) # Enable public link
|
| 93 |
|
| 94 |
if __name__ == "__main__":
|
|
|
|
| 34 |
|
| 35 |
# RAG Query Function
|
| 36 |
def query_rag(message, temperature, max_new_tokens, top_k, repetition_penalty, top_p, system_prompt, history=None):
|
|
|
|
| 37 |
if vector_store is None:
|
| 38 |
return "Please upload and process a PDF first."
|
| 39 |
|
|
|
|
| 80 |
process_btn = gr.Button("Process PDF")
|
| 81 |
process_output = gr.Textbox(label="Processing Status", interactive=False)
|
| 82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
process_btn.click(process_pdf, inputs=[pdf_uploader], outputs=[process_output])
|
| 84 |
|
| 85 |
+
# Create chat interface
|
| 86 |
+
chatbot = gr.ChatInterface(
|
| 87 |
+
lambda message: query_rag(message, 0.7, 10000, 40, 1.1, 0.95, "You are a helpful assistant.")
|
| 88 |
+
)
|
| 89 |
+
|
| 90 |
demo.launch(share=True) # Enable public link
|
| 91 |
|
| 92 |
if __name__ == "__main__":
|