Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,22 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
-
x = st.slider('Select a value')
|
4 |
-
st.write(x, 'squared is', x * x)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
+
# x = st.slider('Select a value')
|
4 |
+
# st.write(x, 'squared is', x * x)
|
5 |
+
|
6 |
+
import streamlit as st
|
7 |
+
import requests
|
8 |
+
|
9 |
+
# Streamlit interface
|
10 |
+
st.title('POST Request Sender')
|
11 |
+
url = st.text_input('Enter the URL', 'https://openai.com/completion')
|
12 |
+
if st.button('Send POST Request'):
|
13 |
+
# Make a POST request
|
14 |
+
try:
|
15 |
+
response = requests.post(url, data={'sample_data': 'value'})
|
16 |
+
if response.status_code == 200:
|
17 |
+
st.success('POST request successful!')
|
18 |
+
st.json(response.json())
|
19 |
+
else:
|
20 |
+
st.error(f'Request failed with status code {response.status_code}')
|
21 |
+
except Exception as e:
|
22 |
+
st.error(f'An error occurred: {e}')
|