当前位置: 首页>>代码示例>>Python>>正文


Python RappCloud.RappCloud类代码示例

本文整理汇总了Python中RappCloud.RappCloud的典型用法代码示例。如果您正苦于以下问题:Python RappCloud类的具体用法?Python RappCloud怎么用?Python RappCloud使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了RappCloud类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

class RappInterfaceTest:

  def __init__(self):
    self.rappCloud = RappCloud()
    self.language = 'el'
    self.text = u'Καλησπέρα. Είμαι ο ναο.'
    self.destDir = '/tmp/'
    # Set the valid results

  def execute(self):
    start_time = timeit.default_timer()
    # Call the Python RappCloud service
    response = self.rappCloud.text_to_speech(self.text, self.language, '')
    end_time = timeit.default_timer()
    self.elapsed_time = end_time - start_time
    return self.validate(response)

  def validate(self, response):
    if response['error']:
        return [response['error'], self.elapsed_time]

    # Get the returned data
    audioData = response['audioData']
    # Check if the returned data are equal to the expected
    if len(audioData) > 0:
        with open(self.destDir + response['basename'], 'wb') as f1:
            f1.write(audioData)
        return [True, self.elapsed_time]
    else:
        return ["Unexpected result : " + 'Invalid size of audio data', self.elapsed_time]
开发者ID:gitter-badger,项目名称:rapp-platform,代码行数:30,代码来源:text_to_speech_test_gr_default.py

示例2: __init__

class RappInterfaceTest:

  def __init__(self):
    self.rappCloud = RappCloud()
    rospack = rospkg.RosPack()
    pkgDir = rospack.get_path('rapp_testing_tools')
    self.file_uri = join(pkgDir, 'test_data',
        'face_samples', 'multi_faces_frames', 'two_faces.jpg')

    self.valid_numFaces = 2


  def execute(self):
    start_time = timeit.default_timer()
    response = self.rappCloud.face_detection(self.file_uri)
    end_time = timeit.default_timer()
    self.elapsed_time = end_time - start_time
    return self.validate(response)

  def validate(self, response):
    error = response['error']
    if error != "":
      return [error, self.elapsed_time]

    numFaces = len(response['faces'])
    if self.valid_numFaces == numFaces:
      return [True, self.elapsed_time]
    else:
      return ["Unexpected result : " + ' Number of faces found -> ' +\
              str(numFaces) + ', expected -> ' + str(self.valid_numFaces), \
              self.elapsed_time]
开发者ID:gitter-badger,项目名称:rapp-platform,代码行数:31,代码来源:face_detection_test_two_faces_jpg.py

示例3: __init__

class RappInterfaceTest:

  def __init__(self):
    self.rappCloud = RappCloud()
    self.ontology_class = "Oven"
    # Set the valid results
    self.valid_results = [
        'http://knowrob.org/kb/knowrob.owl#MicrowaveOven', \
        'http://knowrob.org/kb/knowrob.owl#RegularOven', \
        'http://knowrob.org/kb/knowrob.owl#ToasterOven', \
    ]

  def execute(self):

    start_time = timeit.default_timer()
    # Call the Python RappCloud service
    response = self.rappCloud.ontology_subclasses_of(self.ontology_class)
    end_time = timeit.default_timer()
    self.elapsed_time = end_time - start_time
    return self.validate(response)

  def validate(self, response):
    error = response['error']
    if error != "":
      return [error, self.elapsed_time]

    # Get the returned data
    return_data = response['results']
    # Check if the returned data are equal to the expected
    if self.valid_results == return_data:
      return [True, self.elapsed_time]
    else:
      return ["Unexpected result : " + str(return_data), self.elapsed_time]
开发者ID:gitter-badger,项目名称:rapp-platform,代码行数:33,代码来源:ontology_subclasses_of_test_Oven.py

示例4: __init__

    def __init__(self):
        self.rappCloud = RappCloud()
        rospack = rospkg.RosPack()
        pkgDir = rospack.get_path("rapp_testing_tools")
        self.file_uri = join(pkgDir, "test_data", "qr_samples", "easyMediumQr.jpg")

        self.valid_results = {"qr_centers": [{"y": 498, "x": 632}], "qr_messages": ["Hello there"], "error": ""}
开发者ID:gitter-badger,项目名称:rapp-platform,代码行数:7,代码来源:qr_detection_test_easy_medium.py

示例5: __init__

class RappInterfaceTest:
    def __init__(self):
        self.rappCloud = RappCloud()
        self.username = "rapp"
        self.testType = "ReasoningCts"

    def execute(self):
        start_time = timeit.default_timer()
        # Call the Python RappCloud service
        response = self.rappCloud.cognitive_test_chooser(self.username, self.testType)
        end_time = timeit.default_timer()
        self.elapsed_time = end_time - start_time
        return self.validate(response)

    def validate(self, response):
        error = response["error"]
        if error != "":
            return [error, self.elapsed_time]

        # Get the returned data
        test_instance = response["test_instance"]
        test_type = response["test_type"]
        test_sub_type = response["test_subtype"]
        questions = response["questions"]
        possib_ans = response["possib_ans"]
        correct_ans = response["correct_ans"]
        # Check if the returned data are equal to the expected
        if test_instance and test_type and test_sub_type and questions and possib_ans and correct_ans:
            return [True, self.elapsed_time]
        else:
            return ["Unexpected result : " + str(response), self.elapsed_time]
开发者ID:gitter-badger,项目名称:rapp-platform,代码行数:31,代码来源:cognitive_test_chooser_reasoning.py

示例6: __init__

class RappInterfaceTest:

  def __init__(self):
    self.rappCloud = RappCloud()
    self.username = "rapp"
    self.test = "ReasoningCts_GJNNLYhq"
    self.score = 50
    # Set the valid results
    self.valid_result_partial = "CognitiveTestPerformed"

  def execute(self):
    start_time = timeit.default_timer()
    # Call the Python RappCloud service
    response = self.rappCloud.record_cognitive_test_performance(self.username,
                    self.test, self.score)
    end_time = timeit.default_timer()
    self.elapsed_time = end_time - start_time
    return self.validate(response)

  def validate(self, response):
    error = response['error']
    if error != "":
      return [error, self.elapsed_time]

    # Check if the returned data are equal to the expected
    if self.valid_result_partial in response['performance_entry']:
        return [True, self.elapsed_time]
    else:
        return ["Unexpected result : " + str(response), self.elapsed_time]
开发者ID:gitter-badger,项目名称:rapp-platform,代码行数:29,代码来源:record_cognitive_test_performance_reasoning.py

示例7: __init__

class RappInterfaceTest:

  def __init__(self):
    self.rappCloud = RappCloud()
    rospack = rospkg.RosPack()
    pkgDir = rospack.get_path('rapp_testing_tools')
    self.file_uri = join(pkgDir, 'test_data',
        'qr_samples', 'mediumFarQr.jpg')

    self.valid_results = {
        'qr_centers': [{'y': 585, 'x': 690}],
        'qr_messages': ['This is NAO from Greece'],
        'error': ''
    }


  def execute(self):
    start_time = timeit.default_timer()
    response = self.rappCloud.qr_detection(self.file_uri)
    end_time = timeit.default_timer()
    self.elapsed_time = end_time - start_time
    return self.validate(response)

  def validate(self, response):
    error = response['error']
    if error != "":
      return [error, self.elapsed_time]

    return_data = response
    if self.valid_results == return_data:
      return [True, self.elapsed_time]
    else:
      return ["Unexpected result : " + str(return_data), self.elapsed_time]
开发者ID:gitter-badger,项目名称:rapp-platform,代码行数:33,代码来源:qr_detection_test_medium_far.py

示例8: __init__

class RappInterfaceTest:

  def __init__(self):
    self.rappCloud = RappCloud()
    rospack = rospkg.RosPack()
    pkgDir = rospack.get_path('rapp_testing_tools')
    self.file_uri = join(pkgDir, 'test_data',
        'qr_samples', 'hardMediumQr.jpg')

    self.valid_results = {
        'qr_centers': [{'y': 543, 'x': 661}],
        'qr_messages': ['This QR will be used to check the algorithmic robustness as it is quite small'],
        'error': ''
    }


  def execute(self):
    start_time = timeit.default_timer()
    response = self.rappCloud.qr_detection(self.file_uri)
    end_time = timeit.default_timer()
    self.elapsed_time = end_time - start_time
    return self.validate(response)

  def validate(self, response):
    error = response['error']
    if error != "":
      return [error, self.elapsed_time]

    return_data = response
    if self.valid_results == return_data:
      return [True, self.elapsed_time]
    else:
      return ["Unexpected result : " + str(return_data), self.elapsed_time]
开发者ID:gitter-badger,项目名称:rapp-platform,代码行数:33,代码来源:qr_detection_test_hard_medium.py

示例9: __init__

 def __init__(self):
   self.rappCloud = RappCloud()
   self.username = "rapp"
   self.test = "AwarenessCts_kRmyDqqu"
   self.score = 50
   # Set the valid results
   self.valid_result_partial = "CognitiveTestPerformed"
开发者ID:gitter-badger,项目名称:rapp-platform,代码行数:7,代码来源:record_cognitive_test_performance_awareness.py

示例10: __init__

class RappInterfaceTest:

  def __init__(self):
    self.rappCloud = RappCloud()
    rospack = rospkg.RosPack()
    pkgDir = rospack.get_path('rapp_testing_tools')
    self.file_uri = join(pkgDir, 'test_data',
        'face_samples', 'etsardou_medium_angle.jpg')
    self.valid_faces = [{
        'up_left_point': {'y': 266.0, 'x': 746.0},
        'down_right_point': {'y': 412.0, 'x': 892.0}
    }]


  def execute(self):
    start_time = timeit.default_timer()
    response = self.rappCloud.face_detection(self.file_uri)
    end_time = timeit.default_timer()
    self.elapsed_time = end_time - start_time
    return self.validate(response)

  def validate(self, response):
    error = response['error']
    if error != "":
      return [error, self.elapsed_time]

    faces = response['faces']
    if self.valid_faces == faces:
      return [True, self.elapsed_time]
    else:
      return ["Unexpected result : " + str(response), self.elapsed_time]
开发者ID:gitter-badger,项目名称:rapp-platform,代码行数:31,代码来源:face_detection_test_medium_angle.py

示例11: __init__

class RappInterfaceTest:

  def __init__(self):
    self.rappCloud = RappCloud()
    self.parent_class_ = "SpatialThing"
    self.child_class_ = "Oven"
    self.recursive_ = True
    # Set the valid results
    self.valid_results = True;

  def execute(self):
    start_time = timeit.default_timer()

    # Call the Python RappCloud service
    response = self.rappCloud.ontology_is_subsuperclass_of(self.parent_class_, \
      self.child_class_, self.recursive_)

    end_time = timeit.default_timer()
    self.elapsed_time = end_time - start_time

    return self.validate(response)

  def validate(self, response):
    error = response['error']
    if error != "":
      return [error, self.elapsed_time]

    # Get the returned data
    return_data = response['result']
    # Check if the returned data are equal to the expected
    if self.valid_results == return_data:
      return [True, self.elapsed_time]
    else:
      return ["Unexpected result : " + str(return_data), self.elapsed_time]
开发者ID:gitter-badger,项目名称:rapp-platform,代码行数:34,代码来源:ontology_is_subsuperclass_of_SpatialThing.py

示例12: __init__

class RappInterfaceTest:
    def __init__(self):
        self.rappCloud = RappCloud()
        rospack = rospkg.RosPack()
        pkgDir = rospack.get_path("rapp_testing_tools")
        self.file_uri = join(pkgDir, "test_data", "speech_detection_samples", "recording_tuesday.ogg")

        self.language = "en"
        self.audio_source = "nao_ogg"
        self.words = [u"tuesday", u"monday"]
        self.sentences = self.words
        self.grammar = []
        self.user = "rapp"
        self.valid_words_found = [u"tuesday"]

    def execute(self):
        start_time = timeit.default_timer()
        response = self.rappCloud.speech_detection_sphinx4(
            self.language, self.audio_source, self.words, self.sentences, self.grammar, self.file_uri, self.user
        )
        end_time = timeit.default_timer()
        self.elapsed_time = end_time - start_time
        return self.validate(response)

    def validate(self, response):
        error = response["error"]
        if error != "":
            return [error, self.elapsed_time]

        return_data = response["words"]
        if self.valid_words_found == return_data:
            return [True, self.elapsed_time]
        else:
            return ["Unexpected result : " + str(return_data), self.elapsed_time]
开发者ID:gitter-badger,项目名称:rapp-platform,代码行数:34,代码来源:speech_detection_sphinx_test_ogg_tuesday.py

示例13: __init__

class RappInterfaceTest:

  def __init__(self):
    self.rappCloud = RappCloud()

    # Configure the call parameters
    self.file_uri = __path__  + '/../test_data/YOUR_DATA_HERE_IF_NEEDED'
    # Set the valid results
    self.valid_results = 0

  def execute(self):

    start_time = timeit.default_timer()
    # Call the Python RappCloud service
    response = self.rappCloud.qr_detection(self.file_uri)
    end_time = timeit.default_timer()
    self.elapsed_time = end_time - start_time
    return self.validate(response)

  def validate(self, response):
    error = response['error']
    if error != "":
      return [error, self.elapsed_time]

    return_data = response['qr_centers']
    # Check if the returned data are equal to the expected
    if self.valid_results == return_data:
      return [True, self.elapsed_time]
    else:
      return ["Unexpected result : " + str(return_data), self.elapsed_time]
开发者ID:gitter-badger,项目名称:rapp-platform,代码行数:30,代码来源:template.py

示例14: __init__

class RappInterfaceTest:

  def __init__(self):
    self.rappCloud = RappCloud()
    self.language = 'el'
    self.text = u'Καλησπέρα. Είμαι ο ναο.'
    self.destFilePath = '/tmp/ttsClient.wav'
    # Set the valid results

  def execute(self):
    start_time = timeit.default_timer()
    # Call the Python RappCloud service
    response = self.rappCloud.text_to_speech(self.text, self.language,
                                             self.destFilePath)
    end_time = timeit.default_timer()
    self.elapsed_time = end_time - start_time
    return self.validate(response)

  def validate(self, response):
    if response['error']:
        return [response['error'], self.elapsed_time]

    # Check if the returned data are equal to the expected
    if os.path.getsize(self.destFilePath) > 0:
        return [True, self.elapsed_time]
    else:
        return ["Unexpected result : " + 'Invalid size of audio data', self.elapsed_time]
开发者ID:gitter-badger,项目名称:rapp-platform,代码行数:27,代码来源:text_to_speech_test_gr_auto_store_file.py

示例15: __init__

class RappInterfaceTest:
    def __init__(self):
        self.rappCloud = RappCloud()
        rospack = rospkg.RosPack()
        pkgDir = rospack.get_path("rapp_testing_tools")
        self.file_uri = join(pkgDir, "test_data", "qr_samples", "hardFarQr.jpg")

        self.valid_results = {
            "qr_centers": [{"y": 580, "x": 669}],
            "qr_messages": ["This QR will be used to check the algorithmic robustness as it is quite small"],
            "error": "",
        }

    def execute(self):
        start_time = timeit.default_timer()
        response = self.rappCloud.qr_detection(self.file_uri)
        end_time = timeit.default_timer()
        self.elapsed_time = end_time - start_time
        return self.validate(response)

    def validate(self, response):
        error = response["error"]
        if error != "":
            return [error, self.elapsed_time]

        return_data = response
        if self.valid_results == return_data:
            return [True, self.elapsed_time]
        else:
            return ["Unexpected result : " + str(return_data), self.elapsed_time]
开发者ID:gitter-badger,项目名称:rapp-platform,代码行数:30,代码来源:qr_detection_test_hard_far.py


注:本文中的RappCloud.RappCloud类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。