neovalle commited on
Commit
c00f46c
Β·
verified Β·
1 Parent(s): b9695d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -6
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.Markdown("# 🌲 **Wild Voices** β€” *Listening to the More-than-Human World*")
89
- gr.Markdown("Ask questions to rivers, trees, owls, and more. Generate myths and facts, and let nature's wisdom respond.")
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
- with gr.Row():
104
- output1 = gr.Textbox(label=f"{persona1.value} Responds")
105
- output2 = gr.Textbox(label="Fact-Checker Responds")
 
 
 
 
 
 
 
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])