ningrumdaud commited on
Commit
e1eb9e1
·
verified ·
1 Parent(s): 8342ba8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -19
app.py CHANGED
@@ -193,36 +193,35 @@ def CogMapAnalysis(text):
193
  # Create the GUI using the 'gr' library
194
 
195
  with gr.Blocks() as demo:
 
 
 
196
  with gr.Row():
197
- gr.Markdown("<h1 style='text-align: center;'><strong>CogMApp</strong></h1>")
198
- gr.Markdown("<h3 style='text-align: center;'>Generate cognitive maps from text with one click!</h3>")
199
-
200
- with gr.Row():
201
- inputs = gr.Textbox(label="Input", lines=2, placeholder="Enter your text here...")
202
- examples = [
203
- "Public support for anti-discrimination laws and the movement to support immigrants grew due to the impact of getting widespread education on social justice issues.",
204
- "The introduction of new anti-discrimination laws has been driven by an increasing awareness of social injustices and grassroots movements.",
205
- "The weak law enforcement in this country is due to its citizens's ignorance.",
206
- "CogMApp is a tool that lets you create cognitive maps from text."
207
- ]
208
- examples_dropdown = gr.Dropdown(label="Examples", choices=examples)
209
- submit_button = gr.Button("Submit")
210
 
211
  with gr.Row():
212
- output = gr.Textbox(label="CogMap", lines=1, placeholder="Generated CogMap will appear here.")
213
-
214
  with gr.Row():
215
  cogmap_plot = gr.Plot(label="Visualization")
216
 
217
  with gr.Row():
218
- flag_notice = gr.Markdown("⚠️ Feel free to flag me if you find any errors. 🙂")
219
 
220
  with gr.Column():
221
- gr.Markdown('<p style="text-align: center;">Demo made with ❤ by P.K. Ningrum (2024) | Contact: <a href="https://ningrumdaud.github.io/">https://ningrumdaud.github.io/</a></p>')
222
 
223
- # Linking the button to execute the function
224
  submit_button.click(CogMapAnalysis, inputs=[inputs], outputs=[output, cogmap_plot])
225
- examples_dropdown.change(fn=lambda x: inputs.update(x), inputs=[examples_dropdown], outputs=[inputs])
226
 
227
  if __name__ == "__main__":
228
  demo.launch(show_api=False, share=True)
 
193
  # Create the GUI using the 'gr' library
194
 
195
  with gr.Blocks() as demo:
196
+ gr.Markdown('# CogMApp')
197
+ gr.Markdown('### Generate cognitive maps from text with one click!')
198
+
199
  with gr.Row():
200
+ with gr.Column():
201
+ inputs = gr.Textbox(label="Input", lines=2, placeholder="Enter your text here...")
202
+ submit_button = gr.Button("Submit")
203
+ with gr.Column():
204
+ examples = gr.Examples(examples=[
205
+ "Public support for anti-discrimination laws and the movement to support immigrants grew due to the impact of getting widespread education on social justice issues.",
206
+ "The introduction of new anti-discrimination laws has been driven by an increasing awareness of social injustices and grassroots movements.",
207
+ "The weak enforcement in this country is due to its citizens's ignorance.",
208
+ "CogMApp is a tool that lets you create cognitive maps from text."
209
+ ], inputs=inputs)
 
 
 
210
 
211
  with gr.Row():
212
+ output = gr.Textbox(label="CogMap", lines=10, placeholder="Generated CogMap will appear here.")
213
+
214
  with gr.Row():
215
  cogmap_plot = gr.Plot(label="Visualization")
216
 
217
  with gr.Row():
218
+ gr.Markdown("⚠️ Feel free to flag me if you find any errors. 🙂")
219
 
220
  with gr.Column():
221
+ gr.Markdown('Demo made with ❤ by P.K. Ningrum (2024) | Contact: [https://ningrumdaud.github.io/](https://ningrumdaud.github.io/)')
222
 
223
+ # Set up the button to execute the function when clicked
224
  submit_button.click(CogMapAnalysis, inputs=[inputs], outputs=[output, cogmap_plot])
 
225
 
226
  if __name__ == "__main__":
227
  demo.launch(show_api=False, share=True)