Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -79,6 +79,18 @@ def get_random_myth_or_fact():
|
|
79 |
# Return the myth/fact, update the personas, and fill the responses
|
80 |
return myth_or_fact, persona, persona_response, fact_check_response, f"### {persona} Responds","### Fact Checker"
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
# Dynamically load persona names from instructions folder
|
83 |
personas = [os.path.splitext(f)[0].capitalize() for f in os.listdir("instructions") if f.endswith(".txt")]
|
84 |
|
@@ -149,23 +161,12 @@ with gr.Blocks() as demo:
|
|
149 |
# outputs=[output1, output2]
|
150 |
# )
|
151 |
|
152 |
-
def ask_with_titles(p1, p2, q):
|
153 |
-
# Generate responses
|
154 |
-
response1 = call_cohere_api(load_instruction(p1), q)
|
155 |
-
response2 = call_cohere_api(load_instruction(p2), q)
|
156 |
-
|
157 |
-
# Generate titles
|
158 |
-
title1 = f"### {p1} Responds"
|
159 |
-
title2 = f"### {p2} Responds"
|
160 |
-
|
161 |
-
# Return responses and titles
|
162 |
-
return response1, response2, title1, title2
|
163 |
|
164 |
-
ask_button.click(
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
)
|
169 |
|
170 |
if __name__ == "__main__":
|
171 |
demo.launch()
|
|
|
79 |
# Return the myth/fact, update the personas, and fill the responses
|
80 |
return myth_or_fact, persona, persona_response, fact_check_response, f"### {persona} Responds","### Fact Checker"
|
81 |
|
82 |
+
def ask_with_titles(p1, p2, q):
|
83 |
+
# Generate responses
|
84 |
+
response1 = call_cohere_api(load_instruction(p1), q)
|
85 |
+
response2 = call_cohere_api(load_instruction(p2), q)
|
86 |
+
|
87 |
+
# Generate titles
|
88 |
+
title1 = f"### {p1} Responds"
|
89 |
+
title2 = f"### {p2} Responds"
|
90 |
+
|
91 |
+
# Return responses and titles
|
92 |
+
return response1, response2, title1, title2
|
93 |
+
|
94 |
# Dynamically load persona names from instructions folder
|
95 |
personas = [os.path.splitext(f)[0].capitalize() for f in os.listdir("instructions") if f.endswith(".txt")]
|
96 |
|
|
|
161 |
# outputs=[output1, output2]
|
162 |
# )
|
163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
|
165 |
+
ask_button.click(
|
166 |
+
fn=ask_with_titles,
|
167 |
+
inputs=[persona1, persona2, user_input],
|
168 |
+
outputs=[output1, output2, output1_title, output2_title]
|
169 |
+
)
|
170 |
|
171 |
if __name__ == "__main__":
|
172 |
demo.launch()
|