Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache spark 有没有从卡夫卡主题中使用Keras模型和Pypark结构实现推理的例子?_Apache Spark_Tensorflow_Pyspark_Apache Kafka_Inference - Fatal编程技术网

Apache spark 有没有从卡夫卡主题中使用Keras模型和Pypark结构实现推理的例子?

Apache spark 有没有从卡夫卡主题中使用Keras模型和Pypark结构实现推理的例子?,apache-spark,tensorflow,pyspark,apache-kafka,inference,Apache Spark,Tensorflow,Pyspark,Apache Kafka,Inference,我试图通过改编Databrick的文章来实现这个想法。已经编写了一些测试件,但还没有工作 以下是我将数据写入控制台的测试代码: @pandas_udf(returnType=str()) def online_predict(value): # model = bc_model for batch in value: print(batch) stream = spark.readStream.format("kafka") \ .

我试图通过改编Databrick的文章来实现这个想法。已经编写了一些测试件,但还没有工作

以下是我将数据写入控制台的测试代码:

@pandas_udf(returnType=str())
def online_predict(value):
    # model = bc_model
    for batch in value:
        print(batch)


stream = spark.readStream.format("kafka") \
    .option("kafka.bootstrap.servers", "localhost:9092") \
    .option("subscribe", "network") \
    .load().select(online_predict(col('value')))
感谢您的帮助

编辑:我的目的是等待新消息到达卡夫卡主题,然后使用Keras模型推断它们,最后将结果发送回另一个卡夫卡主题并重复该过程