Spaces:
Sleeping
Sleeping
Srinivasulu kethanaboina commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -65,9 +65,6 @@ def handle_query(query):
|
|
| 65 |
else:
|
| 66 |
response = "Sorry, I couldn't find an answer."
|
| 67 |
|
| 68 |
-
# Append the query and response to chat history
|
| 69 |
-
chat_history.append((query, response))
|
| 70 |
-
|
| 71 |
return response
|
| 72 |
|
| 73 |
# Initialize chat history
|
|
@@ -77,12 +74,6 @@ chat_history = []
|
|
| 77 |
print("Processing PDF ingestion from directory:", PDF_DIRECTORY)
|
| 78 |
data_ingestion_from_directory()
|
| 79 |
|
| 80 |
-
# Example query
|
| 81 |
-
query = "How do I use the RedfernsTech Q&A assistant?"
|
| 82 |
-
print("Query:", query)
|
| 83 |
-
response = handle_query(query)
|
| 84 |
-
print("Answer:", response)
|
| 85 |
-
|
| 86 |
# Define the input and output components for the Gradio interface
|
| 87 |
input_component = gr.Textbox(
|
| 88 |
show_label=False,
|
|
@@ -94,8 +85,8 @@ output_component = gr.Textbox()
|
|
| 94 |
# Function to add chat history to output
|
| 95 |
def chat_with_history(query):
|
| 96 |
response = handle_query(query)
|
| 97 |
-
|
| 98 |
-
return
|
| 99 |
|
| 100 |
# Create the Gradio interface
|
| 101 |
interface = gr.Interface(
|
|
@@ -103,7 +94,7 @@ interface = gr.Interface(
|
|
| 103 |
inputs=input_component,
|
| 104 |
outputs=output_component,
|
| 105 |
title="RedfernsTech Q&A Chatbot",
|
| 106 |
-
description="Ask me anything about the uploaded document.
|
| 107 |
)
|
| 108 |
|
| 109 |
# Launch the Gradio interface
|
|
|
|
| 65 |
else:
|
| 66 |
response = "Sorry, I couldn't find an answer."
|
| 67 |
|
|
|
|
|
|
|
|
|
|
| 68 |
return response
|
| 69 |
|
| 70 |
# Initialize chat history
|
|
|
|
| 74 |
print("Processing PDF ingestion from directory:", PDF_DIRECTORY)
|
| 75 |
data_ingestion_from_directory()
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
# Define the input and output components for the Gradio interface
|
| 78 |
input_component = gr.Textbox(
|
| 79 |
show_label=False,
|
|
|
|
| 85 |
# Function to add chat history to output
|
| 86 |
def chat_with_history(query):
|
| 87 |
response = handle_query(query)
|
| 88 |
+
chat_history.append((query, response))
|
| 89 |
+
return response
|
| 90 |
|
| 91 |
# Create the Gradio interface
|
| 92 |
interface = gr.Interface(
|
|
|
|
| 94 |
inputs=input_component,
|
| 95 |
outputs=output_component,
|
| 96 |
title="RedfernsTech Q&A Chatbot",
|
| 97 |
+
description="Ask me anything about the uploaded document."
|
| 98 |
)
|
| 99 |
|
| 100 |
# Launch the Gradio interface
|