Spaces:
No application file
No application file
| from transformers import pipeline | |
| # Load a pre-trained conversational model | |
| chatbot = pipeline('conversational', model='microsoft/DialoGPT-medium') | |
| def chat(user_input): | |
| # Convert user input to the format expected by the chatbot | |
| # For simplicity, we'll assume the model handles this internally | |
| response = chatbot(user_input)[0]['generated_text'] | |
| return response | |
| if __name__ == '__main__': | |
| print('Welcome to the Chatbot! Type 'exit' to end the conversation.') | |
| while True: | |
| user_input = input('You: ') | |
| if user_input.lower() == 'exit': | |
| print('Chatbot: Goodbye!') | |
| break | |
| response = chat(user_input) | |
| print(f'Chatbot: {response}')} |