abdiharyadi commited on
Commit
c54c0f2
β€’
1 Parent(s): 2d27f56

feat: make output to 2x2, no longer using gr.Interface

Browse files
Files changed (1) hide show
  1. app.py +29 -15
app.py CHANGED
@@ -140,23 +140,30 @@ def run(text, source_style):
140
  with gr.Blocks() as demo:
141
  with gr.Row():
142
  with gr.Column():
143
- gr.Interface(
144
- fn=run,
145
- inputs=[
146
- gr.Textbox(label="Teks (Text)"),
147
- gr.Radio(label="Gaya sumber (Source style)", choices=[
148
- ("Positif (Positive)", "LABEL_1"),
149
- ("Negatif (Negative)", "LABEL_0"),
150
- ], value="LABEL_1"),
151
  ],
152
- outputs=[
153
- gr.Textbox(label="Graf AMR sumber (Source AMR graph)"),
154
- gr.Textbox(label="Triplet (Triplets)"),
155
- gr.Textbox(label="Kata bergaya (Style words)"),
156
- gr.Textbox(label="Graf AMR target (Target AMR graph)"),
157
- gr.Textbox(label="Hasil (Result)"),
158
- ]
159
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
 
161
  with gr.Column():
162
  gr.Markdown("""
@@ -168,4 +175,11 @@ with gr.Blocks() as demo:
168
  - M. Abdi Haryadi. H ([email protected])
169
  """)
170
 
 
 
 
 
 
 
 
171
  demo.launch()
 
140
  with gr.Blocks() as demo:
141
  with gr.Row():
142
  with gr.Column():
143
+ input_textbox = gr.Textbox(label="Teks (Text)")
144
+ style_choices = gr.Radio(
145
+ label="Gaya sumber (Source style)",
146
+ choices=[
147
+ ("Positif (Positive)", "LABEL_1"),
148
+ ("Negatif (Negative)", "LABEL_0"),
 
 
149
  ],
150
+ value="LABEL_1"
 
 
 
 
 
 
151
  )
152
+ submit_btn = gr.Button("Submit")
153
+
154
+ with gr.Row():
155
+ src_amr_graph_output = gr.Textbox(
156
+ label="Graf AMR sumber (Source AMR graph)"
157
+ )
158
+ triplets_output = gr.Textbox(label="Triplet (Triplets)")
159
+
160
+ with gr.Row():
161
+ style_words_output = gr.Textbox(label="Kata bergaya (Style words)")
162
+ tgt_amr_graph_output = gr.Textbox(
163
+ label="Graf AMR target (Target AMR graph)"
164
+ )
165
+
166
+ result_output = gr.Textbox(label="Hasil (Result)")
167
 
168
  with gr.Column():
169
  gr.Markdown("""
 
175
  - M. Abdi Haryadi. H ([email protected])
176
  """)
177
 
178
+ submit_btn.click(
179
+ run,
180
+ [input_textbox, style_choices],
181
+ [src_amr_graph_output, triplets_output, style_words_output,
182
+ tgt_amr_graph_output, result_output]
183
+ )
184
+
185
  demo.launch()