webapp_game_generator / website.py
shujath000's picture
Update website.py
eef2600 verified
raw
history blame contribute delete
694 Bytes
import streamlit as st
import requests as req
import json
box=st.selectbox("please select",options=["Generate App (tkinter)","Generate Game (pygame)"])
text=st.text_input(label="please enter the app description")
json={"prompt": f"{box}\n{text}"}
but=st.button(label="submit")
if but:
res=req.post(url="https://habeeb7890.app.n8n.cloud/webhook/02e48592-0da1-4ad8-848b-b80f1554e996",json=json)
if res==200:
with open("app.py","w") as f:
f.write(json.loads(s)["output"])
with open("app.py","r") as f:
st.download_button(label="download code",data=f,file_name="codefile")
else:
st.error("cant able to send http request to server")