SarowarSaurav commited on
Commit
9178f13
·
verified ·
1 Parent(s): b0839d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -2525,16 +2525,13 @@ knowledge_base = {
2525
 
2526
  }
2527
 
 
2528
  def chatbot_interface(acronym):
2529
  acronym = acronym.strip().upper() # Remove leading/trailing whitespace and convert to uppercase
2530
  if acronym in knowledge_base:
2531
  response = f"Answer: {knowledge_base[acronym]}"
2532
  else:
2533
- closest_match = difflib.get_close_matches(acronym, knowledge_base.keys(), n=1)
2534
- if closest_match:
2535
- response = f"No exact match found. Did you mean '{closest_match[0]}'?"
2536
- else:
2537
- response = "Not found in the BATCCAPEDIA"
2538
  return response
2539
 
2540
  # Create the Gradio interface
@@ -2549,4 +2546,4 @@ iface = gr.Interface(
2549
  )
2550
 
2551
  # Launch the interface
2552
- iface.launch()
 
2525
 
2526
  }
2527
 
2528
+ # Define the Gradio interface function
2529
  def chatbot_interface(acronym):
2530
  acronym = acronym.strip().upper() # Remove leading/trailing whitespace and convert to uppercase
2531
  if acronym in knowledge_base:
2532
  response = f"Answer: {knowledge_base[acronym]}"
2533
  else:
2534
+ response = "Not found in the BATCCAPEDIA"
 
 
 
 
2535
  return response
2536
 
2537
  # Create the Gradio interface
 
2546
  )
2547
 
2548
  # Launch the interface
2549
+ iface.launch()