Spaces:
Sleeping
Sleeping
AbdelrahmanRagab
commited on
Commit
•
f20103b
1
Parent(s):
76b3c1b
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
# Define your API function
|
4 |
-
def get_json_response():
|
5 |
# Here you can define your logic to generate JSON data
|
6 |
data = {
|
7 |
-
"name":
|
8 |
-
"age":
|
9 |
-
"email":
|
10 |
}
|
11 |
return data
|
12 |
|
@@ -14,11 +14,16 @@ def get_json_response():
|
|
14 |
def main():
|
15 |
st.title('Simple JSON API')
|
16 |
|
17 |
-
#
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
# Display the JSON response
|
21 |
st.json(json_data)
|
22 |
|
23 |
if __name__ == "__main__":
|
24 |
-
main()
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
# Define your API function
|
4 |
+
def get_json_response(name, age, email):
|
5 |
# Here you can define your logic to generate JSON data
|
6 |
data = {
|
7 |
+
"name": name,
|
8 |
+
"age": age,
|
9 |
+
"email": email
|
10 |
}
|
11 |
return data
|
12 |
|
|
|
14 |
def main():
|
15 |
st.title('Simple JSON API')
|
16 |
|
17 |
+
# Add inputs for user to customize JSON data
|
18 |
+
name = st.text_input("Name", "John Doe")
|
19 |
+
age = st.number_input("Age", min_value=0, max_value=150, value=30)
|
20 |
+
email = st.text_input("Email", "john.doe@example.com")
|
21 |
+
|
22 |
+
# Call your API function with user inputs
|
23 |
+
json_data = get_json_response(name, age, email)
|
24 |
|
25 |
# Display the JSON response
|
26 |
st.json(json_data)
|
27 |
|
28 |
if __name__ == "__main__":
|
29 |
+
main()
|