fixed python code
This commit is contained in:
parent
6f42514fd5
commit
0d43a9b32b
1 changed files with 11 additions and 12 deletions
|
|
@ -14,7 +14,7 @@ import { oneDark } from 'react-syntax-highlighter/dist/cjs/styles/prism';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default function ApiModal({flowName}) {
|
export default function ApiModal({ flowName }) {
|
||||||
const [open, setOpen] = useState(true);
|
const [open, setOpen] = useState(true);
|
||||||
const { dark } = useContext(darkContext);
|
const { dark } = useContext(darkContext);
|
||||||
const { closePopUp } = useContext(PopUpContext);
|
const { closePopUp } = useContext(PopUpContext);
|
||||||
|
|
@ -49,24 +49,23 @@ export default function ApiModal({flowName}) {
|
||||||
API_URL = "${window.location.protocol}//${window.location.host}/predict"
|
API_URL = "${window.location.protocol}//${window.location.host}/predict"
|
||||||
|
|
||||||
def predict(message):
|
def predict(message):
|
||||||
with open("${flowName}.json:, "r") as f:
|
with open("${flowName}.json", "r") as f:
|
||||||
json_data = json.load(f)
|
json_data = json.load(f)
|
||||||
payload['exported_flow'] = json_data
|
payload = {'exported_flow': json_data, 'message': message}
|
||||||
payload['message'] = message
|
|
||||||
response = requests.post(API_URL, json=payload)
|
response = requests.post(API_URL, json=payload)
|
||||||
return response.json() # JSON {"result": "Response"}
|
return response.json() # JSON {"result": "Response"}
|
||||||
|
|
||||||
print(predict("Your message"))`;
|
print(predict("Your message"))`;
|
||||||
|
|
||||||
const tabs = [
|
const tabs = [
|
||||||
{
|
{
|
||||||
name: "Python",
|
name: "Python",
|
||||||
mode: "python",
|
mode: "python",
|
||||||
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
image: "https://cdn-icons-png.flaticon.com/512/5968/5968350.png",
|
||||||
code: pythonCode,
|
code: pythonCode,
|
||||||
},
|
},
|
||||||
|
|
||||||
]
|
]
|
||||||
return (
|
return (
|
||||||
<Transition.Root show={open} appear={true} as={Fragment}>
|
<Transition.Root show={open} appear={true} as={Fragment}>
|
||||||
<Dialog
|
<Dialog
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue