arjunanand13 commited on
Commit
9838768
1 Parent(s): 3fa5f3b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +77 -14
app.py CHANGED
@@ -122,7 +122,8 @@ if __name__ == "__main__":
122
 
123
  doc_retrieval_gen = DocumentRetrievalAndGeneration(embedding_model_name, lm_model_id, data_folder)
124
 
125
- # Define Gradio interface function
 
126
  def launch_interface():
127
  css_code = """
128
  .gradio-container {
@@ -138,21 +139,23 @@ if __name__ == "__main__":
138
  font-size: 16px; /* Increase font size */
139
  font-weight: bold; /* Make text bold */
140
  }
141
- """
142
- EXAMPLES = ["Can the VIP and CSI2 modules operate simultaneously? ",
143
- "I'm using Code Composer Studio 5.4.0.00091 and enabled FPv4SPD16 floating point support for CortexM4 in TDA2. However, after building the project, the .asm file shows --float_support=vfplib instead of FPv4SPD16. Why is this happening?",
144
- "Could you clarify the maximum number of cameras that can be connected simultaneously to the video input ports on the TDA2x SoC, considering it supports up to 10 multiplexed input ports and includes 3 dedicated video input modules?"]
145
-
 
 
146
  file_path = "ticketNames.txt"
147
-
148
  # Read the file content
149
  with open(file_path, "r") as file:
150
  content = file.read()
151
  ticket_names = json.loads(content)
152
  dropdown = gr.Dropdown(label="Sample queries", choices=ticket_names)
153
-
154
- # Define Gradio interface
155
- interface = gr.Interface(
156
  fn=doc_retrieval_gen.qa_infer_gradio,
157
  inputs=[gr.Textbox(label="QUERY", placeholder="Enter your query here")],
158
  allow_flagging='never',
@@ -161,9 +164,69 @@ if __name__ == "__main__":
161
  outputs=[gr.Textbox(label="SOLUTION"), gr.Textbox(label="RELATED QUERIES")],
162
  css=css_code
163
  )
164
-
165
- # Launch Gradio interface
166
- interface.launch(debug=True)
167
-
 
 
 
 
 
 
 
 
 
 
 
 
168
  # Launch the interface
169
  launch_interface()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
  doc_retrieval_gen = DocumentRetrievalAndGeneration(embedding_model_name, lm_model_id, data_folder)
124
 
125
+ """Dual Interface"""
126
+
127
  def launch_interface():
128
  css_code = """
129
  .gradio-container {
 
139
  font-size: 16px; /* Increase font size */
140
  font-weight: bold; /* Make text bold */
141
  }
142
+ """
143
+ EXAMPLES = [
144
+ "On which devices can the VIP and CSI2 modules operate simultaneously?",
145
+ "I'm using Code Composer Studio 5.4.0.00091 and enabled FPv4SPD16 floating point support for CortexM4 in TDA2. However, after building the project, the .asm file shows --float_support=vfplib instead of FPv4SPD16. Why is this happening?",
146
+ "Could you clarify the maximum number of cameras that can be connected simultaneously to the video input ports on the TDA2x SoC, considering it supports up to 10 multiplexed input ports and includes 3 dedicated video input modules?"
147
+ ]
148
+
149
  file_path = "ticketNames.txt"
150
+
151
  # Read the file content
152
  with open(file_path, "r") as file:
153
  content = file.read()
154
  ticket_names = json.loads(content)
155
  dropdown = gr.Dropdown(label="Sample queries", choices=ticket_names)
156
+
157
+ # Define Gradio interfaces
158
+ tab1 = gr.Interface(
159
  fn=doc_retrieval_gen.qa_infer_gradio,
160
  inputs=[gr.Textbox(label="QUERY", placeholder="Enter your query here")],
161
  allow_flagging='never',
 
164
  outputs=[gr.Textbox(label="SOLUTION"), gr.Textbox(label="RELATED QUERIES")],
165
  css=css_code
166
  )
167
+ tab2 = gr.Interface(
168
+ fn=doc_retrieval_gen.qa_infer_gradio,
169
+ inputs=[dropdown],
170
+ allow_flagging='never',
171
+ outputs=[gr.Textbox(label="SOLUTION"), gr.Textbox(label="RELATED QUERIES")],
172
+ css=css_code
173
+ )
174
+
175
+ # Combine interfaces into a tabbed interface
176
+ gr.TabbedInterface(
177
+ [tab1, tab2],
178
+ ["Textbox Input", "FAQs"],
179
+ title="TI E2E FORUM",
180
+ css=css_code
181
+ ).launch(debug=True)
182
+
183
  # Launch the interface
184
  launch_interface()
185
+
186
+
187
+
188
+ """Single Interface"""
189
+ # def launch_interface():
190
+ # css_code = """
191
+ # .gradio-container {
192
+ # background-color: #daccdb;
193
+ # }
194
+ # /* Button styling for all buttons */
195
+ # button {
196
+ # background-color: #927fc7; /* Default color for all other buttons */
197
+ # color: black;
198
+ # border: 1px solid black;
199
+ # padding: 10px;
200
+ # margin-right: 10px;
201
+ # font-size: 16px; /* Increase font size */
202
+ # font-weight: bold; /* Make text bold */
203
+ # }
204
+ # """
205
+ # EXAMPLES = ["On which devices can the VIP and CSI2 modules operate simultaneously? ",
206
+ # "I'm using Code Composer Studio 5.4.0.00091 and enabled FPv4SPD16 floating point support for CortexM4 in TDA2. However, after building the project, the .asm file shows --float_support=vfplib instead of FPv4SPD16. Why is this happening?",
207
+ # "Could you clarify the maximum number of cameras that can be connected simultaneously to the video input ports on the TDA2x SoC, considering it supports up to 10 multiplexed input ports and includes 3 dedicated video input modules?"]
208
+
209
+ # file_path = "ticketNames.txt"
210
+
211
+ # # Read the file content
212
+ # with open(file_path, "r") as file:
213
+ # content = file.read()
214
+ # ticket_names = json.loads(content)
215
+ # dropdown = gr.Dropdown(label="Sample queries", choices=ticket_names)
216
+
217
+ # # Define Gradio interface
218
+ # interface = gr.Interface(
219
+ # fn=doc_retrieval_gen.qa_infer_gradio,
220
+ # inputs=[gr.Textbox(label="QUERY", placeholder="Enter your query here")],
221
+ # allow_flagging='never',
222
+ # examples=EXAMPLES,
223
+ # cache_examples=False,
224
+ # outputs=[gr.Textbox(label="SOLUTION"), gr.Textbox(label="RELATED QUERIES")],
225
+ # css=css_code
226
+ # )
227
+
228
+ # # Launch Gradio interface
229
+ # interface.launch(debug=True)
230
+
231
+ # # Launch the interface
232
+ # launch_interface()