jchen8000 commited on
Commit
54d4ede
·
verified ·
1 Parent(s): 00438a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -91,7 +91,7 @@ def load_sample_pdf():
91
  for file in sample_filenames:
92
  loader = PyPDFLoader(file)
93
  documents.extend(loader.load())
94
- print(f"{file} is processed!")
95
 
96
  # Split the documents into chunks
97
  text_splitter = RecursiveCharacterTextSplitter(chunk_size=1024, chunk_overlap=64)
@@ -133,7 +133,7 @@ def generate_response(query, history, model, temperature, max_tokens, top_p, see
133
 
134
  response = rag_chain.invoke(query)
135
 
136
- return response
137
 
138
  additional_inputs = [
139
  gr.Dropdown(choices=["llama-3.3-70b-versatile", "llama-3.1-8b-instant", "llama3-70b-8192", "llama3-8b-8192", "mixtral-8x7b-32768", "gemma2-9b-it"], value="gemma2-9b-it", label="Model"),
@@ -143,6 +143,10 @@ additional_inputs = [
143
  gr.Number(precision=0, value=0, label="Seed", info="A starting point to initiate generation, use 0 for random")
144
  ]
145
 
 
 
 
 
146
  # Create the Gradio interface
147
  with gr.Blocks(theme=gr.themes.Default()) as demo:
148
  with gr.Tab("Indexing"):
@@ -164,7 +168,7 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
164
  chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
165
  examples=examples_questions,
166
  additional_inputs=additional_inputs,
167
- # additional_outputs=[relevant_info],
168
  cache_examples=False,
169
  )
170
  # with gr.Column():
 
91
  for file in sample_filenames:
92
  loader = PyPDFLoader(file)
93
  documents.extend(loader.load())
94
+ # print(f"{file} is processed!")
95
 
96
  # Split the documents into chunks
97
  text_splitter = RecursiveCharacterTextSplitter(chunk_size=1024, chunk_overlap=64)
 
133
 
134
  response = rag_chain.invoke(query)
135
 
136
+ return response, relevant_info
137
 
138
  additional_inputs = [
139
  gr.Dropdown(choices=["llama-3.3-70b-versatile", "llama-3.1-8b-instant", "llama3-70b-8192", "llama3-8b-8192", "mixtral-8x7b-32768", "gemma2-9b-it"], value="gemma2-9b-it", label="Model"),
 
143
  gr.Number(precision=0, value=0, label="Seed", info="A starting point to initiate generation, use 0 for random")
144
  ]
145
 
146
+ additional_outputs = [
147
+ gr.Textbox(label="Retrieved Information", interactive=False, lines=10)
148
+ ]
149
+
150
  # Create the Gradio interface
151
  with gr.Blocks(theme=gr.themes.Default()) as demo:
152
  with gr.Tab("Indexing"):
 
168
  chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
169
  examples=examples_questions,
170
  additional_inputs=additional_inputs,
171
+ additional_outputs=additional_outputs,
172
  cache_examples=False,
173
  )
174
  # with gr.Column():