app5 / app.py
AbdelrahmanRagab's picture
Update app.py
f20103b verified
raw
history blame contribute delete
735 Bytes
import streamlit as st
# Define your API function
def get_json_response(name, age, email):
# Here you can define your logic to generate JSON data
data = {
"name": name,
"age": age,
"email": email
}
return data
# Main Streamlit app
def main():
st.title('Simple JSON API')
# Add inputs for user to customize JSON data
name = st.text_input("Name", "John Doe")
age = st.number_input("Age", min_value=0, max_value=150, value=30)
email = st.text_input("Email", "john.doe@example.com")
# Call your API function with user inputs
json_data = get_json_response(name, age, email)
# Display the JSON response
st.json(json_data)
if __name__ == "__main__":
main()