Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -191,27 +191,37 @@ def CogMapAnalysis(text):
|
|
191 |
|
192 |
# Create the GUI using the 'gr' library
|
193 |
with gr.Blocks() as demo:
|
194 |
-
|
195 |
-
gr.Markdown('<div style="text-align: center;"><h1><strong>CogMApp</strong></h1></div> <div style="text-align: center;"><h3>Generate cognitive maps from text with one click!</h3></div>')
|
196 |
|
197 |
with gr.Row():
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
|
|
|
|
|
|
209 |
|
210 |
-
|
211 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
|
213 |
-
|
214 |
-
|
|
|
215 |
|
216 |
if __name__ == "__main__":
|
217 |
demo.launch(show_api=False, share=True)
|
|
|
|
191 |
|
192 |
# Create the GUI using the 'gr' library
|
193 |
with gr.Blocks() as demo:
|
194 |
+
gr.Markdown('<div style="text-align: center;"><h1><strong>CogMApp</strong></h1></div> <div style="text-align: center;"><h3>Generate cognitive maps from text with one click!</h3></div>')
|
|
|
195 |
|
196 |
with gr.Row():
|
197 |
+
with gr.Column():
|
198 |
+
inputs = gr.Textbox(label="Input Text", lines=4, placeholder="Enter your text here...")
|
199 |
+
output = gr.Textbox(label="CogMap Output", lines=4, placeholder="Processed output appears here...", interactive=False)
|
200 |
+
submit_button = gr.Button("Submit")
|
201 |
+
with gr.Column():
|
202 |
+
cogmap_plot = gr.Plot(label="Visualization")
|
203 |
+
gr.Markdown("⚠️ Feel free to flag me if you find any errors. 🙂")
|
204 |
+
|
205 |
+
examples = [
|
206 |
+
"Public support for anti-discrimination laws and the movement to support immigrants grew due to the impact of widespread education on social justice issues.",
|
207 |
+
"The introduction of new anti-discrimination laws has been driven by an increasing awareness of social injustices and grassroots movements.",
|
208 |
+
"The weak enforcement in this country is due to its citizens' ignorance.",
|
209 |
+
"CogMApp is a tool that lets you create cognitive maps from text."
|
210 |
+
]
|
211 |
|
212 |
+
def update_output(input_text):
|
213 |
+
return CogMapAnalysis(input_text)
|
214 |
+
|
215 |
+
submit_button.click(
|
216 |
+
fn=update_output,
|
217 |
+
inputs=inputs,
|
218 |
+
outputs=[output, cogmap_plot]
|
219 |
+
)
|
220 |
|
221 |
+
inputs.add_examples(examples, fn=CogMapAnalysis)
|
222 |
+
|
223 |
+
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>')
|
224 |
|
225 |
if __name__ == "__main__":
|
226 |
demo.launch(show_api=False, share=True)
|
227 |
+
|