Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -84,25 +84,42 @@ personas = [os.path.splitext(f)[0].capitalize() for f in os.listdir("instruction
|
|
84 |
|
85 |
# Gradio Interface
|
86 |
with gr.Blocks() as demo:
|
|
|
87 |
with gr.Row():
|
88 |
-
gr.
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
with gr.Row():
|
92 |
persona1 = gr.Dropdown(personas, label="Choose First Persona", value="Tree")
|
93 |
persona2 = gr.Dropdown(personas, label="Choose Second Persona", value="Crow")
|
94 |
|
|
|
95 |
with gr.Row():
|
96 |
user_input = gr.Textbox(label="π± Your Question", placeholder="e.g., What do you think of humans?", lines=2)
|
97 |
random_button = gr.Button("π² Generate Random Question")
|
98 |
myth_fact_button = gr.Button("π Generate Random Myth/Fact")
|
99 |
|
|
|
100 |
with gr.Row():
|
101 |
ask_button = gr.Button("π Submit Question")
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
# Button events
|
108 |
random_button.click(fn=get_random_question, inputs=[], outputs=[user_input])
|
|
|
84 |
|
85 |
# Gradio Interface
|
86 |
with gr.Blocks() as demo:
|
87 |
+
# Header with Image
|
88 |
with gr.Row():
|
89 |
+
with gr.Column(scale=0.15):
|
90 |
+
gr.Image(value="data/MoreThanHumanVoices.png", label="More Than Human Voices", show_label=False)
|
91 |
+
with gr.Column():
|
92 |
+
gr.Markdown("""
|
93 |
+
# π² **Wild Voices**
|
94 |
+
*Listening to the More-than-Human World*
|
95 |
+
Ask questions to rivers, trees, owls, and more. Generate myths and facts, and let nature's wisdom respond.
|
96 |
+
""")
|
97 |
+
|
98 |
+
# Persona Selection
|
99 |
with gr.Row():
|
100 |
persona1 = gr.Dropdown(personas, label="Choose First Persona", value="Tree")
|
101 |
persona2 = gr.Dropdown(personas, label="Choose Second Persona", value="Crow")
|
102 |
|
103 |
+
# Question and buttons
|
104 |
with gr.Row():
|
105 |
user_input = gr.Textbox(label="π± Your Question", placeholder="e.g., What do you think of humans?", lines=2)
|
106 |
random_button = gr.Button("π² Generate Random Question")
|
107 |
myth_fact_button = gr.Button("π Generate Random Myth/Fact")
|
108 |
|
109 |
+
# Submit button
|
110 |
with gr.Row():
|
111 |
ask_button = gr.Button("π Submit Question")
|
112 |
|
113 |
+
# Response display
|
114 |
+
output1 = gr.Textbox(label="Tree Responds")
|
115 |
+
output2 = gr.Textbox(label="Crow Responds")
|
116 |
+
|
117 |
+
# Update labels when dropdown changes
|
118 |
+
def update_labels(p1, p2):
|
119 |
+
return f"{p1} Responds", f"{p2} Responds"
|
120 |
+
|
121 |
+
persona1.change(fn=update_labels, inputs=[persona1, persona2], outputs=[output1, output2])
|
122 |
+
persona2.change(fn=update_labels, inputs=[persona1, persona2], outputs=[output1, output2])
|
123 |
|
124 |
# Button events
|
125 |
random_button.click(fn=get_random_question, inputs=[], outputs=[user_input])
|