Update app.py
Browse files
app.py
CHANGED
@@ -94,7 +94,7 @@ def generate_response(user_query, relevant_segment):
|
|
94 |
print(f"Error in generating response: {e}")
|
95 |
return f"Error in generating response: {e}"
|
96 |
|
97 |
-
def query_model(question
|
98 |
"""
|
99 |
Process a question, find relevant information, and generate a response using inputted book title.
|
100 |
"""
|
@@ -149,16 +149,15 @@ with gr.Blocks(theme='JohnSmith9982/small_and_pretty') as demo:
|
|
149 |
gr.Markdown(topics)
|
150 |
with gr.Row():
|
151 |
with gr.Column():
|
152 |
-
book = gr.Dropdown(
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
question =
|
157 |
gr.Markdown(space)
|
158 |
submit_button = gr.Button("Submit")
|
159 |
answer = gr.Textbox(label="LitBot Response", placeholder="LitBot will respond here...", interactive=False, lines=30)
|
160 |
-
submit_button.click(fn=query_model, inputs=question
|
161 |
-
submit_button.click(fn=query_model, inputs=question and book, outputs=answer)
|
162 |
|
163 |
|
164 |
# Launch the Gradio app to allow user interaction
|
|
|
94 |
print(f"Error in generating response: {e}")
|
95 |
return f"Error in generating response: {e}"
|
96 |
|
97 |
+
def query_model(question):
|
98 |
"""
|
99 |
Process a question, find relevant information, and generate a response using inputted book title.
|
100 |
"""
|
|
|
149 |
gr.Markdown(topics)
|
150 |
with gr.Row():
|
151 |
with gr.Column():
|
152 |
+
# book = gr.Dropdown(
|
153 |
+
# ["The Great Gatsby", "The Crucible", "Fahrenheit 451", "Of Mice and Men", "To Kill a Mockingbird", "Romeo and Juliet", "The Catcher in the Rye", "Pride and Prejudice", "Lord of the Flies", "Hamlet"],
|
154 |
+
# label = "Choose a book!",
|
155 |
+
# interactive = True )
|
156 |
+
question = gr.Textbox(label="Your question", placeholder="What do you want to ask about?")
|
157 |
gr.Markdown(space)
|
158 |
submit_button = gr.Button("Submit")
|
159 |
answer = gr.Textbox(label="LitBot Response", placeholder="LitBot will respond here...", interactive=False, lines=30)
|
160 |
+
submit_button.click(fn=query_model, inputs=question, outputs=answer)
|
|
|
161 |
|
162 |
|
163 |
# Launch the Gradio app to allow user interaction
|