如何解决按顺序使用 preprocess_input() 时出错
在我的应用程序中,我需要预处理噪声图像以通过我的模型进行推理,但是当我使用 preprocess_input 时我遇到了这个问题:
AttributeError: Sequential object has no attribute preprocess_input
struct ContentView: View {
@State var temp = Int()
func CallApi(){
let url = URL(string: "https://api.openweathermap.org/data/2.5/weather?q=budapest&appid=#########################################")
URLSession.shared.dataTask(with: url!){data,response,error in
if let data = data {
if let DecodedData = try? JSONDecoder().decode(Api.self,from: data){
self.temp = DecodedData.main.temp
}
}
}.resume()
}
struct Api: Codable,Hashable{
var main: Datastructre
}
struct Datastructre: Codable,Hashable {
var temp: Int
}
var body: some View {
Text("\(temp)")
Button("Idojaras"){CallApi()}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
可以使用 preprocess_input 吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。