Код:
import streamlit as st
import json
import requests
import numpy as np
URI = 'http://127.0.0.1:5000'
st.title('Newral Network Visualizer')
st.sidebar.markdown('## Input image')
if st.button('Get random prediction'):
response = requests.post(URI, data={})
response = json.loads(response.text)
Вывод:
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Отслеживание:
File "c:\users\niloy\anaconda3\lib\site-packages\streamlit\ScriptRunner.py", line 322, in _run_script
exec(code, module.__dict__)
File "C:\Users\Niloy\Downloads\Digit classifier with flask\app.py", line 14, in <module>
response = json.loads(response.text)
File "c:\users\niloy\anaconda3\lib\json\__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "c:\users\niloy\anaconda3\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "c:\users\niloy\anaconda3\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None