Update app.py
Browse files
app.py
CHANGED
@@ -34,6 +34,7 @@ def stream_chat_with_rag(
|
|
34 |
)
|
35 |
|
36 |
# Debugging: Print the raw response
|
|
|
37 |
print("Raw answer from API:")
|
38 |
print(answer)
|
39 |
history.append((message, response +"\n"+ answer))
|
@@ -191,11 +192,11 @@ with gr.Blocks(title="Reddit Election Analysis") as demo:
|
|
191 |
gr.Markdown("Ask questions about election-related comments and posts")
|
192 |
|
193 |
with gr.Row():
|
194 |
-
with gr.
|
195 |
year_selector = gr.Radio(
|
196 |
choices=["2016 Election", "2024 Election", "Comparison two years"],
|
197 |
label="Select Election Year",
|
198 |
-
value="
|
199 |
)
|
200 |
slider = gr.Slider(50, 500, render=False, label= "Tokens")
|
201 |
|
@@ -207,19 +208,20 @@ with gr.Blocks(title="Reddit Election Analysis") as demo:
|
|
207 |
|
208 |
# submit_btn = gr.Button("Submit")
|
209 |
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
|
|
216 |
# with gr.Column():
|
217 |
# output_text = gr.Textbox(
|
218 |
# label="Response",
|
219 |
# lines=20
|
220 |
# )
|
221 |
|
222 |
-
with gr.
|
223 |
gr.ChatInterface(stream_chat_with_rag,
|
224 |
type="messages",
|
225 |
# chatbot=stream_chat_with_rag,
|
|
|
34 |
)
|
35 |
|
36 |
# Debugging: Print the raw response
|
37 |
+
response = f"Retrieving the submissions in {year}..."
|
38 |
print("Raw answer from API:")
|
39 |
print(answer)
|
40 |
history.append((message, response +"\n"+ answer))
|
|
|
192 |
gr.Markdown("Ask questions about election-related comments and posts")
|
193 |
|
194 |
with gr.Row():
|
195 |
+
with gr.Row():
|
196 |
year_selector = gr.Radio(
|
197 |
choices=["2016 Election", "2024 Election", "Comparison two years"],
|
198 |
label="Select Election Year",
|
199 |
+
value="2024 Election"
|
200 |
)
|
201 |
slider = gr.Slider(50, 500, render=False, label= "Tokens")
|
202 |
|
|
|
208 |
|
209 |
# submit_btn = gr.Button("Submit")
|
210 |
|
211 |
+
gr.Markdown("""
|
212 |
+
## Example Questions:
|
213 |
+
- Is there any comments don't like the election results
|
214 |
+
- Summarize the main discussions about voting process
|
215 |
+
- What are the common opinions about candidates?
|
216 |
+
- What's commen opinions about immigrant topic?
|
217 |
+
""")
|
218 |
# with gr.Column():
|
219 |
# output_text = gr.Textbox(
|
220 |
# label="Response",
|
221 |
# lines=20
|
222 |
# )
|
223 |
|
224 |
+
with gr.Row():
|
225 |
gr.ChatInterface(stream_chat_with_rag,
|
226 |
type="messages",
|
227 |
# chatbot=stream_chat_with_rag,
|