aizanlabs commited on
Commit
c1b3675
·
verified ·
1 Parent(s): 2251410

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +76 -76
app.py CHANGED
@@ -161,70 +161,8 @@ if __name__ == "__main__":
161
 
162
  doc_retrieval_gen = DocumentRetrievalAndGeneration(embedding_model_name, lm_model_id, data_folder)
163
 
164
- """Dual Interface"""
165
 
166
- def launch_interface():
167
- css_code = """
168
- .gradio-container {
169
- background-color: #daccdb;
170
- }
171
- /* Button styling for all buttons */
172
- button {
173
- background-color: #927fc7; /* Default color for all other buttons */
174
- color: black;
175
- border: 1px solid black;
176
- padding: 10px;
177
- margin-right: 10px;
178
- font-size: 16px; /* Increase font size */
179
- font-weight: bold; /* Make text bold */
180
- }
181
- """
182
- EXAMPLES = [
183
- "On which devices can the VIP and CSI2 modules operate simultaneously?",
184
- "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?",
185
- "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?"
186
- ]
187
-
188
- file_path = "ticketNames.txt"
189
-
190
- # Read the file content
191
- with open(file_path, "r") as file:
192
- content = file.read()
193
- ticket_names = json.loads(content)
194
- dropdown = gr.Dropdown(label="Sample queries", choices=ticket_names)
195
-
196
- # Define Gradio interfaces
197
- tab1 = gr.Interface(
198
- fn=doc_retrieval_gen.qa_infer_gradio,
199
- inputs=[gr.Textbox(label="QUERY", placeholder="Enter your query here")],
200
- allow_flagging='never',
201
- examples=EXAMPLES,
202
- cache_examples=False,
203
- outputs=[gr.Textbox(label="SOLUTION"), gr.Textbox(label="RELATED QUERIES")],
204
- css=css_code
205
- )
206
- tab2 = gr.Interface(
207
- fn=doc_retrieval_gen.qa_infer_gradio,
208
- inputs=[dropdown],
209
- allow_flagging='never',
210
- outputs=[gr.Textbox(label="SOLUTION"), gr.Textbox(label="RELATED QUERIES")],
211
- css=css_code
212
- )
213
-
214
- # Combine interfaces into a tabbed interface
215
- gr.TabbedInterface(
216
- [tab1, tab2],
217
- ["Textbox Input", "FAQs"],
218
- title="TI E2E FORUM",
219
- css=css_code
220
- ).launch(debug=True)
221
-
222
- # Launch the interface
223
- launch_interface()
224
-
225
-
226
-
227
- """Single Interface"""
228
  # def launch_interface():
229
  # css_code = """
230
  # .gradio-container {
@@ -240,21 +178,23 @@ if __name__ == "__main__":
240
  # font-size: 16px; /* Increase font size */
241
  # font-weight: bold; /* Make text bold */
242
  # }
243
- # """
244
- # EXAMPLES = ["On which devices can the VIP and CSI2 modules operate simultaneously? ",
245
- # "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?",
246
- # "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?"]
247
-
 
 
248
  # file_path = "ticketNames.txt"
249
-
250
  # # Read the file content
251
  # with open(file_path, "r") as file:
252
  # content = file.read()
253
  # ticket_names = json.loads(content)
254
  # dropdown = gr.Dropdown(label="Sample queries", choices=ticket_names)
255
-
256
- # # Define Gradio interface
257
- # interface = gr.Interface(
258
  # fn=doc_retrieval_gen.qa_infer_gradio,
259
  # inputs=[gr.Textbox(label="QUERY", placeholder="Enter your query here")],
260
  # allow_flagging='never',
@@ -263,9 +203,69 @@ if __name__ == "__main__":
263
  # outputs=[gr.Textbox(label="SOLUTION"), gr.Textbox(label="RELATED QUERIES")],
264
  # css=css_code
265
  # )
266
-
267
- # # Launch Gradio interface
268
- # interface.launch(debug=True)
269
-
 
 
 
 
 
 
 
 
 
 
 
 
270
  # # Launch the interface
271
  # launch_interface()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
 
162
  doc_retrieval_gen = DocumentRetrievalAndGeneration(embedding_model_name, lm_model_id, data_folder)
163
 
164
+ # """Dual Interface"""
165
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  # def launch_interface():
167
  # css_code = """
168
  # .gradio-container {
 
178
  # font-size: 16px; /* Increase font size */
179
  # font-weight: bold; /* Make text bold */
180
  # }
181
+ # """
182
+ # EXAMPLES = [
183
+ # "On which devices can the VIP and CSI2 modules operate simultaneously?",
184
+ # "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?",
185
+ # "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?"
186
+ # ]
187
+
188
  # file_path = "ticketNames.txt"
189
+
190
  # # Read the file content
191
  # with open(file_path, "r") as file:
192
  # content = file.read()
193
  # ticket_names = json.loads(content)
194
  # dropdown = gr.Dropdown(label="Sample queries", choices=ticket_names)
195
+
196
+ # # Define Gradio interfaces
197
+ # tab1 = gr.Interface(
198
  # fn=doc_retrieval_gen.qa_infer_gradio,
199
  # inputs=[gr.Textbox(label="QUERY", placeholder="Enter your query here")],
200
  # allow_flagging='never',
 
203
  # outputs=[gr.Textbox(label="SOLUTION"), gr.Textbox(label="RELATED QUERIES")],
204
  # css=css_code
205
  # )
206
+ # tab2 = gr.Interface(
207
+ # fn=doc_retrieval_gen.qa_infer_gradio,
208
+ # inputs=[dropdown],
209
+ # allow_flagging='never',
210
+ # outputs=[gr.Textbox(label="SOLUTION"), gr.Textbox(label="RELATED QUERIES")],
211
+ # css=css_code
212
+ # )
213
+
214
+ # # Combine interfaces into a tabbed interface
215
+ # gr.TabbedInterface(
216
+ # [tab1, tab2],
217
+ # ["Textbox Input", "FAQs"],
218
+ # title="TI E2E FORUM",
219
+ # css=css_code
220
+ # ).launch(debug=True)
221
+
222
  # # Launch the interface
223
  # launch_interface()
224
+
225
+
226
+
227
+ """Single Interface"""
228
+ def launch_interface():
229
+ css_code = """
230
+ .gradio-container {
231
+ background-color: #daccdb;
232
+ }
233
+ /* Button styling for all buttons */
234
+ button {
235
+ background-color: #927fc7; /* Default color for all other buttons */
236
+ color: black;
237
+ border: 1px solid black;
238
+ padding: 10px;
239
+ margin-right: 10px;
240
+ font-size: 16px; /* Increase font size */
241
+ font-weight: bold; /* Make text bold */
242
+ }
243
+ """
244
+ EXAMPLES = ["On which devices can the VIP and CSI2 modules operate simultaneously? ",
245
+ "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?",
246
+ "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?"]
247
+
248
+ file_path = "ticketNames.txt"
249
+
250
+ # Read the file content
251
+ with open(file_path, "r") as file:
252
+ content = file.read()
253
+ ticket_names = json.loads(content)
254
+ dropdown = gr.Dropdown(label="Sample queries", choices=ticket_names)
255
+
256
+ # Define Gradio interface
257
+ interface = gr.Interface(
258
+ fn=doc_retrieval_gen.qa_infer_gradio,
259
+ inputs=[gr.Textbox(label="QUERY", placeholder="Enter your query here")],
260
+ allow_flagging='never',
261
+ examples=EXAMPLES,
262
+ cache_examples=False,
263
+ outputs=[gr.Textbox(label="SOLUTION"), gr.Textbox(label="RELATED QUERIES")],
264
+ css=css_code
265
+ )
266
+
267
+ # Launch Gradio interface
268
+ interface.launch(debug=True)
269
+
270
+ Launch the interface
271
+ launch_interface()