matthewfarant commited on
Commit
b05f901
·
verified ·
1 Parent(s): c74009c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -2
app.py CHANGED
@@ -146,15 +146,32 @@ def fact_check_flow(user_question):
146
  # Step 5: Use scraped data as context and run generate chain
147
 
148
  final_response = generate_chain.invoke({"question": user_question, "context": context})
 
 
 
 
 
 
 
 
 
149
 
150
- return final_response
 
 
151
 
152
  # Example Use
153
  # user_question = "biden is not joining election in 2024"
154
  # result = fact_check_flow(user_question)
155
  # print(result)
156
 
157
- demo = gr.Interface(fn=fact_check_flow, inputs="textbox", outputs="textbox")
 
 
 
 
 
 
158
 
159
  if __name__ == "__main__":
160
  demo.launch()
 
146
  # Step 5: Use scraped data as context and run generate chain
147
 
148
  final_response = generate_chain.invoke({"question": user_question, "context": context})
149
+
150
+ # Process output
151
+ verdict = final_response['system_verdict']
152
+ explanation = final_response['explanation']
153
+
154
+ if verdict == "Fact":
155
+ verdict_html = f"<span style='color:green; font-size: 24px;'><strong>{verdict}</strong></span>"
156
+ else:
157
+ verdict_html = f"<span style='color:red; font-size: 24px;'><strong>{verdict}</strong></span>"
158
 
159
+ explanation_html = f"<p style='font-size: 14px;'>{explanation}</p>"
160
+
161
+ return verdict_html + explanation_html
162
 
163
  # Example Use
164
  # user_question = "biden is not joining election in 2024"
165
  # result = fact_check_flow(user_question)
166
  # print(result)
167
 
168
+ demo = gr.Interface(
169
+ fn=fact_check_flow,
170
+ inputs="textbox",
171
+ outputs="html",
172
+ title="Fact or Fiction: LLama-powered Fact-Checker AI Agent",
173
+ description="This is a fact checker engine that uses web crawling and LLM for verifying user information. This prototype is being used by the author to submit a proposal for Meta's competition."
174
+ )
175
 
176
  if __name__ == "__main__":
177
  demo.launch()