Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -162,37 +162,83 @@ examples = [
|
|
162 |
["You know, this conversation reminded me of an incredible experience I had at a music festival in college. I'll never forget it. It was a rainy day, but we didn't care, and the band that was playing was my absolute favorite. Even though we were all soaked, the crowd kept on dancing and singing along. The energy was incredible, and I remember feeling so connected to everyone around me. It was as if the rain made the whole experience even more magical. I was surrounded by friends, and we all shared this special moment together. It was one of the best moments of my life, and I still get goosebumps when I think about it. Sometimes, it's the unexpected things that create the most amazing memories, you know?"],
|
163 |
]
|
164 |
|
165 |
-
# Define
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
gr.
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
)
|
196 |
-
|
197 |
-
#
|
198 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
["You know, this conversation reminded me of an incredible experience I had at a music festival in college. I'll never forget it. It was a rainy day, but we didn't care, and the band that was playing was my absolute favorite. Even though we were all soaked, the crowd kept on dancing and singing along. The energy was incredible, and I remember feeling so connected to everyone around me. It was as if the rain made the whole experience even more magical. I was surrounded by friends, and we all shared this special moment together. It was one of the best moments of my life, and I still get goosebumps when I think about it. Sometimes, it's the unexpected things that create the most amazing memories, you know?"],
|
163 |
]
|
164 |
|
165 |
+
# Define the sections as Markdown content
|
166 |
+
intro_text = """
|
167 |
+
# Introduction
|
168 |
+
Welcome to this Gradio app. This section provides an introduction to the app.
|
169 |
+
"""
|
170 |
+
method_text = """
|
171 |
+
# Method
|
172 |
+
This section describes the methodology used in this app.
|
173 |
+
"""
|
174 |
+
demo_text = """
|
175 |
+
# Demo
|
176 |
+
Below is the interactive demo of the app.
|
177 |
+
"""
|
178 |
+
conclusion_text = """
|
179 |
+
# Conclusion
|
180 |
+
This section provides conclusions and future directions.
|
181 |
+
"""
|
182 |
+
|
183 |
+
# Define the main content display area
|
184 |
+
content = gr.Markdown(intro_text)
|
185 |
+
|
186 |
+
# Define the update function for the main content area
|
187 |
+
def update_content(section):
|
188 |
+
if section == "Introduction":
|
189 |
+
return gr.Markdown.update(value=intro_text)
|
190 |
+
elif section == "Method":
|
191 |
+
return gr.Markdown.update(value=method_text)
|
192 |
+
elif section == "Demo":
|
193 |
+
return gr.Markdown.update(value=demo_text)
|
194 |
+
elif section == "Conclusion":
|
195 |
+
return gr.Markdown.update(value=conclusion_text)
|
196 |
+
|
197 |
+
# Define the Gradio interface with a sidebar for navigation
|
198 |
+
with gr.Blocks(theme=MPGPoster()) as demo:
|
199 |
+
with gr.Row():
|
200 |
+
with gr.Column(scale=1):
|
201 |
+
gr.Markdown("## Navigation")
|
202 |
+
sections = ["Introduction", "Method", "Demo", "Conclusion"]
|
203 |
+
section_buttons = [gr.Button(section) for section in sections]
|
204 |
+
|
205 |
+
for button, section in zip(section_buttons, sections):
|
206 |
+
button.click(fn=update_content, inputs=gr.Button(label=section), outputs=content)
|
207 |
+
|
208 |
+
with gr.Column(scale=4):
|
209 |
+
content
|
210 |
+
|
211 |
+
with gr.Row():
|
212 |
+
iface = gr.Interface(
|
213 |
+
fn=all,
|
214 |
+
inputs=gr.Textbox(lines=5, label="Input Text", placeholder="Write about how your breakfast went or anything else that happend or might happen to you ..."),
|
215 |
+
outputs=[
|
216 |
+
gr.HighlightedText(label="Binary Sequence Classification",
|
217 |
+
color_map={
|
218 |
+
"External": "#6ad5bcff",
|
219 |
+
"Internal": "#ee8bacff"}
|
220 |
+
),
|
221 |
+
gr.HighlightedText(label="Extended Sequence Classification",
|
222 |
+
color_map={
|
223 |
+
"INTemothou": "#c27ba0",
|
224 |
+
"INTpercept": "#cc4125",
|
225 |
+
"INTtime": "#e06f66",
|
226 |
+
"INTplace": "#e69138",
|
227 |
+
"INTevent": "#ee8bacff",
|
228 |
+
"EXTsemantic": "#6ad5bc",
|
229 |
+
"EXTrepetition": "#11aeb8",
|
230 |
+
"EXTother": "#24aaad",
|
231 |
+
}
|
232 |
+
),
|
233 |
+
gr.Label(label="Internal Detail Count"),
|
234 |
+
gr.Label(label="External Detail Count"),
|
235 |
+
gr.Label(label="Approximated Internal Detail Ratio")
|
236 |
+
],
|
237 |
+
title="Scoring Demo",
|
238 |
+
description="Autobiographical Memory Analysis: This demo combines two text - and two sequence classification models to showcase our automated Autobiographical Interview scoring method. Submit a narrative to see the results.",
|
239 |
+
examples=examples,
|
240 |
+
)
|
241 |
+
iface.render()
|
242 |
+
|
243 |
+
# Launch the app
|
244 |
+
demo.launch()
|