forked from snehankekre/st-codespaces
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathipfs-test.py
73 lines (58 loc) · 2.75 KB
/
ipfs-test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import streamlit as st
import requests
import os
def main():
st.title("SEC Filing Information")
company_name = st.text_input("Company Name")
form_type = st.selectbox("Form Type", ["10-K", "10-Q", "8-K", "S-1"])
filing_date = st.date_input("Filing Date")
if form_type == "10-K":
st.write("Additional Information:")
fiscal_year_end = st.date_input("Fiscal Year End")
company_size = st.selectbox("Company Size", ["Large Accelerated Filer", "Accelerated Filer", "Non-Accelerated Filer", "Smaller Reporting Company"])
elif form_type == "10-Q":
st.write("Additional Information:")
quarter_end = st.date_input("Quarter End")
elif form_type == "8-K":
st.write("Additional Information:")
event_type = st.selectbox("Event Type", ["Current Report", "Change in Fiscal Year End", "Other Event"])
if event_type == "Other Event":
event_description = st.text_input("Event Description")
elif form_type == "S-1":
st.write("Additional Information:")
offering_amount = st.number_input("Offering Amount")
use_of_proceeds = st.text_input("Use of Proceeds")
file_upload = st.file_uploader("Upload Filing", type=['pdf', 'txt', 'docx'])
if st.button("Submit"):
st.write("Company Name: ", company_name)
st.write("Form Type: ", form_type)
st.write("Filing Date: ", filing_date)
if form_type == "10-K":
st.write("Fiscal Year End: ", fiscal_year_end)
st.write("Company Size: ", company_size)
elif form_type == "10-Q":
st.write("Quarter End: ", quarter_end)
elif form_type == "8-K":
st.write("Event Type: ", event_type)
if event_type == "Other Event":
st.write("Event Description: ", event_description)
elif form_type == "S-1":
st.write("Offering Amount: ", offering_amount)
st.write("Use of Proceeds: ", use_of_proceeds)
if file_upload is not None:
pinata_api_key = os.environ.get("YOUR_PINATA_API_KEY")
pinata_secret_api_key = os.environ.get("YOUR_PINATA_SECRET_API_KEY")
endpoint = "https://api.pinata.cloud/pinning/pinFileToIPFS"
headers = {
"pinata_api_key": pinata_api_key,
"pinata_secret_api_key": pinata_secret_api_key
}
files = {'file': file_upload.getvalue()}
response = requests.post(endpoint, headers=headers, files=files)
if response.status_code == 200:
st.write("File uploaded successfully!")
st.write("IPFS Hash: ", response.json()['IpfsHash'])
else:
st.write("Error uploading file")
if __name__ == "__main__":
main()