python - JSONDecodeError:预期值:第 1 行第 1 列(字符 0)。streamlit 应用程序中出现问题
问题描述
我正在使用 python 制作一个神经网络可视化器 web 应用程序,但是当我运行 streamlit 应用程序的代码时,它一直向我显示这个 json 解码错误。有人可以告诉我我应该如何解决这个错误。在此处输入代码
%%writefile app.py
import streamlit as st
import json
import requests
import matplotlib.pyplot as plt
import numpy as np
URI = 'http://127.0.0.1:5000'
st.title('Neural Network Visualizer')
st.sidebar.markdown('## Input Image')
if st.button('Get random prediction'):
response = requests.post(URI, data={})
response = json.loads(response.text)
preds = response.get('prediction')
image = response.get('image')
image = np.reshape(image, (28, 28))
st.image(image, width=150)
解决方案
推荐阅读
- amazon-web-services - AWS 静态网站托管重定向不适用于 Apple 产品?
- regex - Google Data Studio 中的 REGEX RE2 提取 - REGEX_EXTRACT
- python - 在 python 和 selenium 中爬取基于 angularjs 的网站
- vue.js - 按键删除对象不会更新vue组件
- android - values not showing correctly in dropdown
- c# - 使用 selenium 从标签中提取名称或 href 而无需单击
- ios - 如何执行两次嵌入转场?
- python - PYTHON INSERT MYSql 查询
- c# - 无法访问另一个类中的类字段
- c++ - 如何在 C++ 中以帕斯卡三角形打印曲棍球棒的元素?