Spaces:
Runtime error
Runtime error
import streamlit as st | |
# x = st.slider('Select a value') | |
# st.write(x, 'squared is', x * x) | |
import streamlit as st | |
import requests | |
# Streamlit interface | |
st.title('POST Request Sender') | |
url = st.text_input('Enter the URL', 'https://openai.com/completion') | |
if st.button('Send POST Request'): | |
# Make a POST request | |
try: | |
response = requests.post(url, data={'sample_data': 'value'}) | |
if response.status_code == 200: | |
st.success('POST request successful!') | |
st.json(response.json()) | |
else: | |
st.error(f'Request failed with status code {response.status_code}') | |
except Exception as e: | |
st.error(f'An error occurred: {e}') | |