Download app.py from Pezh/Sql: direct link, hf CLI and curl.
- Browser
- Download file 567 Bytes
-
https://huggingface.co/spaces/Pezh/Sql/resolve/main/app.py
- Command line
-
hf download hf://spaces/Pezh/Sql/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Pezh/Sql/resolve/main/app.py
567 Bytes
| import streamlit as st | |
| import requests | |
| st.title('SQL Database Interaction') | |
| text_input = st.text_input('Enter some text') | |
| save_button = st.button('Save to Database') | |
| if save_button: | |
| url = 'https://pezhma.ir/save_data.php' | |
| data = {'text_input': text_input} | |
| response = requests.post(url, data=data) | |
| if response.status_code == 200: | |
| index = response.text # Retrieve the index from the response | |
| st.success(f'Data saved to the database on Server B with index: {index}')#{index[:-2]}') | |
| else: | |
| st.error('Error saving data') |