Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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.
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 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=
|
| 213 |
-
|
| 214 |
with gr.Row():
|
| 215 |
cogmap_plot = gr.Plot(label="Visualization")
|
| 216 |
|
| 217 |
with gr.Row():
|
| 218 |
-
|
| 219 |
|
| 220 |
with gr.Column():
|
| 221 |
-
gr.Markdown('
|
| 222 |
|
| 223 |
-
#
|
| 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)
|