Update app.py
Browse files
app.py
CHANGED
@@ -158,17 +158,19 @@ def ask_llama(conversation_history, category, is_final_guess=False):
|
|
158 |
# (replacing the original BlenderBot approach with DialoGPT for simplicity)
|
159 |
def ask_help_agent(query):
|
160 |
try:
|
161 |
-
from transformers import pipeline
|
162 |
-
#
|
163 |
-
help_chat = pipeline("
|
164 |
-
#
|
165 |
-
|
166 |
-
response
|
167 |
-
|
168 |
-
return response
|
|
|
169 |
except Exception as e:
|
170 |
return f"Error in help agent: {str(e)}"
|
171 |
|
|
|
172 |
# Main game logic
|
173 |
def main():
|
174 |
inject_custom_css()
|
|
|
158 |
# (replacing the original BlenderBot approach with DialoGPT for simplicity)
|
159 |
def ask_help_agent(query):
|
160 |
try:
|
161 |
+
from transformers import pipeline, Conversation
|
162 |
+
# Use the conversational pipeline with DialoGPT-medium for dialogue context
|
163 |
+
help_chat = pipeline("conversational", model="microsoft/DialoGPT-medium")
|
164 |
+
# Create a Conversation object to hold the context
|
165 |
+
conv = Conversation(query)
|
166 |
+
# Generate a response by passing the conversation object
|
167 |
+
response = help_chat(conv)
|
168 |
+
# Extract and return the generated response from the conversation
|
169 |
+
return conv.generated_responses[-1]
|
170 |
except Exception as e:
|
171 |
return f"Error in help agent: {str(e)}"
|
172 |
|
173 |
+
|
174 |
# Main game logic
|
175 |
def main():
|
176 |
inject_custom_css()
|