This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
68 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright (c) 2017-present, Facebook, Inc. | ||
# All rights reserved. | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. An additional grant | ||
# of patent rights can be found in the PATENTS file in the same directory. | ||
"""Agent does gets the local keyboard input in the act() function. | ||
Example: python examples/eval_model.py -m local_human -t babi:Task1k:1 -dt valid | ||
""" | ||
|
||
from parlai.core.agents import Agent | ||
from parlai.core.worlds import display_messages | ||
|
||
class LocalHumanAgent(Agent): | ||
|
||
def __init__(self, opt, shared=None): | ||
super().__init__(opt) | ||
self.id = 'localHuman' | ||
|
||
def observe(self, msg): | ||
print(display_messages([msg])) | ||
|
||
def act(self): | ||
obs = self.observation | ||
reply = {} | ||
reply['id'] = self.getID() | ||
reply['text'] = input("Enter Your Reply: ") | ||
return reply |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters