karthickg12 commited on
Commit
0d3caec
1 Parent(s): fc07358

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +49 -8
app.py CHANGED
@@ -17,16 +17,57 @@
17
  # st.write(summarizer(t1))
18
 
19
  #from transformers import AutoTokenizer, AutoModel
20
- import streamlit as st
21
 
22
  #tokenizer = AutoTokenizer.from_pretrained("llmware/industry-bert-insurance-v0.1")
23
 
24
- #model = AutoModel.from_pretrained("llmware/industry-bert-insurance-v0.1")
25
- # Use a pipeline as a high-level helper
26
- from transformers import pipeline
27
 
28
- #pipe = pipeline("feature-extraction")
29
 
30
- t=st.text_input("Enter the Text")
31
- pipe = pipeline("summarization")
32
- st.write(pipe(t))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  # st.write(summarizer(t1))
18
 
19
  #from transformers import AutoTokenizer, AutoModel
20
+ # import streamlit as st
21
 
22
  #tokenizer = AutoTokenizer.from_pretrained("llmware/industry-bert-insurance-v0.1")
23
 
24
+ # #model = AutoModel.from_pretrained("llmware/industry-bert-insurance-v0.1")
25
+ # # Use a pipeline as a high-level helper
26
+ # from transformers import pipeline
27
 
28
+ # #pipe = pipeline("feature-extraction")
29
 
30
+ # t=st.text_input("Enter the Text")
31
+ # pipe = pipeline("summarization")
32
+ # st.write(pipe(t))
33
+
34
+
35
+ import pandas as pd
36
+ import numpy as np
37
+ from ydata_synthetic.synthesizers.regular import RegularSynthesizer
38
+ from ydata_synthetic.synthesizers import ModelParameters, TrainParameters
39
+ import streamlit as st
40
+ from os import getcwd
41
+ text_file=st.file_uploader("Upload the Data File")
42
+ st.write("-------------------------")
43
+
44
+ if text_file is not None:
45
+ df=pd.read_csv(text_file)
46
+ dd_list=df.columns
47
+ cat_cols=st.multiselect("Select the Categorical Columns",dd_list)
48
+ num_cols=st.multiselect("Select the Numerical Columns",dd_list)
49
+ Output_file=st.text_input('Enter Output File Name')
50
+ s=st.number_input('Enter the Sample Size',1000)
51
+ OP=Output_file + '.csv'
52
+ sub=st.button('Submit')
53
+ if sub:
54
+ batch_size = 50
55
+ epochs = 3
56
+ learning_rate = 2e-4
57
+ beta_1 = 0.5
58
+ beta_2 = 0.9
59
+
60
+ ctgan_args = ModelParameters(batch_size=batch_size,
61
+ lr=learning_rate,
62
+ betas=(beta_1, beta_2))
63
+
64
+ train_args = TrainParameters(epochs=epochs)
65
+ synth = RegularSynthesizer(modelname='ctgan', model_parameters=ctgan_args)
66
+ synth.fit(data=df, train_arguments=train_args, num_cols=num_cols, cat_cols=cat_cols)
67
+ df_syn = synth.sample(s)
68
+ df_syn.to_csv(OP)
69
+ c=getcwd()
70
+ c=c + '/' + OP
71
+ with open(c,"rb") as file:
72
+ st.download_button(label=':blue[Download]',data=file,file_name=OP,mime="image/png")
73
+ st.success("Thanks for using the app !!!")