iisadia commited on
Commit
dbcd0b9
·
verified ·
1 Parent(s): 1dd8568

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -156,7 +156,12 @@ def ask_llama(conversation_history, category, is_final_guess=False):
156
 
157
  # New function for the help AI assistant using a Hugging Face chatbot model
158
  def ask_help_agent(query):
159
- from transformers import Conversation
 
 
 
 
 
160
  # Get the cached help agent (BlenderBot)
161
  help_agent = get_help_agent()
162
  conversation = Conversation(query)
 
156
 
157
  # New function for the help AI assistant using a Hugging Face chatbot model
158
  def ask_help_agent(query):
159
+ # Use a try/except block to import Conversation from the correct module,
160
+ # accommodating different versions of transformers
161
+ try:
162
+ from transformers import Conversation
163
+ except ImportError:
164
+ from transformers.pipelines.conversational import Conversation
165
  # Get the cached help agent (BlenderBot)
166
  help_agent = get_help_agent()
167
  conversation = Conversation(query)