parthasonu505 commited on
Commit
4cfd57d
·
verified ·
1 Parent(s): de93e19

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -4,7 +4,7 @@ import streamlit.components.v1 as components
4
  from PIL import Image
5
  from io import BytesIO
6
  import mysql.connector
7
-
8
  # Load the Excel file
9
  st.set_page_config(layout="wide")
10
 
@@ -89,10 +89,14 @@ if st.session_state.go:
89
  indob=st.text_input('DOB', str(filtered_df['DOB'].values[0]))
90
  submit=st.button("submit", type="primary")
91
  if picture:
92
- st.session_state.df.loc[st.session_state.df.Code == ipcode, 'Picture'] =f"Photo/{ipclass}/{ipsection}/{ipcode}_{ipname}.jpg"
93
- ippic=f"Photo/{ipclass}/{ipsection}/{ipcode}_{ipname}.jpg"
94
- with open(f"Photo/{ipclass}/{ipsection}/{ipcode}_{ipname}.jpg", 'wb') as f:
95
- f.write(picture.getvalue())
 
 
 
 
96
  if(submit):
97
  st.session_state.df['Name'][index]=ipname
98
  st.session_state.df['Address'][index]=ipaddress
@@ -108,7 +112,7 @@ if st.session_state.go:
108
  st.session_state.df['Mother\'s Name'][index]=inmn
109
  st.session_state.df['Blood Group'][index]=inbg
110
  st.session_state.df['DOB'][index]=indob
111
- #st.session_state.df.to_excel(f"Data/temp/{school_name}_{ipclass}_data.xlsx")
112
  #df = pd.read_excel(f"Data/temp/{school_name}_{ipclass}_data.xlsx", sheet_name='Sheet1')
113
 
114
  myconn = mysql.connector.connect(host = "193.203.184.80", user = "u669719505_school",passwd = "+=I^|BhLc7D", database = "u669719505_school")
 
4
  from PIL import Image
5
  from io import BytesIO
6
  import mysql.connector
7
+ import ftplib
8
  # Load the Excel file
9
  st.set_page_config(layout="wide")
10
 
 
89
  indob=st.text_input('DOB', str(filtered_df['DOB'].values[0]))
90
  submit=st.button("submit", type="primary")
91
  if picture:
92
+ st.session_state.df.loc[st.session_state.df.Code == ipcode, 'Picture'] =f"Photo_{ipclass}_{ipsection}_{ipcode}_{ipname}.jpg"
93
+ ippic=f"Photo_{ipclass}_{ipsection}_{ipcode}_{ipname}.jpg"
94
+ print("Picture name: ",ippic)
95
+ session = ftplib.FTP('ftp.digidemy.in','u669719505.partha','Partha123$#@')
96
+ session.storbinary(f'STOR {ippic}', picture)
97
+ session.quit()
98
+ # with open(f"Photo/{ipclass}/{ipsection}/{ipcode}_{ipname}.jpg", 'wb') as f:
99
+ # f.write(picture.getvalue())
100
  if(submit):
101
  st.session_state.df['Name'][index]=ipname
102
  st.session_state.df['Address'][index]=ipaddress
 
112
  st.session_state.df['Mother\'s Name'][index]=inmn
113
  st.session_state.df['Blood Group'][index]=inbg
114
  st.session_state.df['DOB'][index]=indob
115
+ st.session_state.df.to_excel(f"Data/temp/{school_name}_{ipclass}_data.xlsx")
116
  #df = pd.read_excel(f"Data/temp/{school_name}_{ipclass}_data.xlsx", sheet_name='Sheet1')
117
 
118
  myconn = mysql.connector.connect(host = "193.203.184.80", user = "u669719505_school",passwd = "+=I^|BhLc7D", database = "u669719505_school")