RamAnanth1 commited on
Commit
6d47c20
1 Parent(s): 838384f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +121 -4
app.py CHANGED
@@ -1,7 +1,124 @@
1
  import gradio as gr
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ import pandas as pd
3
+ from realtabformer import REaLTabFormer
4
 
5
+ rtf_model = REaLTabFormer(
6
+ 11 model_type="tabular",
7
+ 12 gradient_accumulation_steps=4)
8
 
9
+
10
+ def generate_data(file):
11
+ df = pd.read_csv(file)
12
+ rtf_model.fit(df)
13
+ # Generate synthetic data
14
+ samples = rtf_model.sample(n_samples=5)
15
+
16
+ return samples
17
+
18
+ css = """
19
+ .gradio-container {
20
+ font-family: 'IBM Plex Sans', sans-serif;
21
+ }
22
+ .gr-button {
23
+ color: white;
24
+ border-color: black;
25
+ background: black;
26
+ }
27
+ input[type='range'] {
28
+ accent-color: black;
29
+ }
30
+ .dark input[type='range'] {
31
+ accent-color: #dfdfdf;
32
+ }
33
+ .container {
34
+ max-width: 730px;
35
+ margin: auto;
36
+ padding-top: 1.5rem;
37
+ }
38
+ #gallery {
39
+ min-height: 22rem;
40
+ margin-bottom: 15px;
41
+ margin-left: auto;
42
+ margin-right: auto;
43
+ border-bottom-right-radius: .5rem !important;
44
+ border-bottom-left-radius: .5rem !important;
45
+ }
46
+ #gallery>div>.h-full {
47
+ min-height: 20rem;
48
+ }
49
+ .details:hover {
50
+ text-decoration: underline;
51
+ }
52
+ .gr-button {
53
+ white-space: nowrap;
54
+ }
55
+ .gr-button:focus {
56
+ border-color: rgb(147 197 253 / var(--tw-border-opacity));
57
+ outline: none;
58
+ box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
59
+ --tw-border-opacity: 1;
60
+ --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
61
+ --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px var(--tw-ring-offset-width)) var(--tw-ring-color);
62
+ --tw-ring-color: rgb(191 219 254 / var(--tw-ring-opacity));
63
+ --tw-ring-opacity: .5;
64
+ }
65
+ #advanced-btn {
66
+ font-size: .7rem !important;
67
+ line-height: 19px;
68
+ margin-top: 12px;
69
+ margin-bottom: 12px;
70
+ padding: 2px 8px;
71
+ border-radius: 14px !important;
72
+ }
73
+ #advanced-options {
74
+ display: none;
75
+ margin-bottom: 20px;
76
+ }
77
+ .footer {
78
+ margin-bottom: 45px;
79
+ margin-top: 35px;
80
+ text-align: center;
81
+ border-bottom: 1px solid #e5e5e5;
82
+ }
83
+ .footer>p {
84
+ font-size: .8rem;
85
+ display: inline-block;
86
+ padding: 0 10px;
87
+ transform: translateY(10px);
88
+ background: white;
89
+ }
90
+ .dark .footer {
91
+ border-color: #303030;
92
+ }
93
+ .dark .footer>p {
94
+ background: #0b0f19;
95
+ }
96
+ """
97
+ with gr.Blocks(css = css) as demo:
98
+ gr.Markdown("""
99
+ ## REaLTabFormer: Generating Realistic Relational and Tabular Data using Transformers
100
+ """)
101
+ # gr.HTML('''
102
+ # <p style="margin-bottom: 10px; font-size: 94%">
103
+ # Whisper is a general-purpose speech recognition model released by OpenAI that can perform multilingual speech recognition as well as speech translation and language identification. Combined with an emotion detection model,this allows for detecting emotion directly from speech in multiple languages and can potentially be used to analyze sentiment from customer calls. It could also be used to transcribe and detect different emotions to enable a data-driven analysis for psychotherapy.
104
+ # </p>
105
+ # ''')
106
+
107
+ with gr.Column():
108
+ #gr.Markdown(""" ### Record audio """)
109
+ # with gr.Tab("Record Audio"):
110
+ # audio_input_r = gr.Audio(label = 'Record Audio Input',source="microphone",type="filepath")
111
+ # transcribe_audio_r = gr.Button('Transcribe')
112
+
113
+ with gr.Tab("Upload Data as File"):
114
+ data_input_u = gr.File(label = 'Upload Data File', file_types=["text", ".json", ".csv"])
115
+ generate_data_btn = gr.Button('Generate Synthetic Data')
116
+
117
+ with gr.Row():
118
+ data_output = gr.Dataframe(label = "Synthetic Data")
119
+
120
+
121
+ generate_data_btn.click(generate_data, inputs = data_input_u, outputs = [data_output])
122
+
123
+
124
+ demo.launch()