Spaces:
Runtime error
Runtime error
Dustin Haring
commited on
Commit
·
8b6ea20
1
Parent(s):
37aac00
Added debug mode checkbox and added a try catch
Browse files
app.py
CHANGED
@@ -64,15 +64,13 @@ def google_fact_checker_prompt(user_input):
|
|
64 |
return prompt
|
65 |
|
66 |
def setup():
|
67 |
-
st.title('
|
68 |
|
69 |
search = TavilySearchAPIWrapper(tavily_api_key='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')
|
70 |
description = """"A search engine optimized for comprehensive, accurate, \
|
71 |
and trusted results. Useful for when you need to answer questions \
|
72 |
about current events or about recent information. \
|
73 |
-
Input should be a
|
74 |
-
If the user is asking about something that you don't know about, \
|
75 |
-
you should probably use this tool to see if that can provide any information."""
|
76 |
tavily_tool = [TavilySearchResults(api_wrapper=search, description=description)]
|
77 |
|
78 |
# Global: Turn Off Gemini safety!
|
@@ -102,6 +100,10 @@ def main():
|
|
102 |
agent_chain = setup()
|
103 |
|
104 |
user_input = st.text_input("Enter a statement/article title")
|
|
|
|
|
|
|
|
|
105 |
|
106 |
if user_input:
|
107 |
|
@@ -127,7 +129,11 @@ def main():
|
|
127 |
answers = list()
|
128 |
for source, prompt in prompts:
|
129 |
log(f'prompt=="""{prompt}"""')
|
130 |
-
|
|
|
|
|
|
|
|
|
131 |
log(f"answers+={answers[-1]}")
|
132 |
|
133 |
# Get prompt results
|
|
|
64 |
return prompt
|
65 |
|
66 |
def setup():
|
67 |
+
st.title('New Article Title or Statement Truth Evaluator')
|
68 |
|
69 |
search = TavilySearchAPIWrapper(tavily_api_key='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')
|
70 |
description = """"A search engine optimized for comprehensive, accurate, \
|
71 |
and trusted results. Useful for when you need to answer questions \
|
72 |
about current events or about recent information. \
|
73 |
+
Input should be a statement or article title."""
|
|
|
|
|
74 |
tavily_tool = [TavilySearchResults(api_wrapper=search, description=description)]
|
75 |
|
76 |
# Global: Turn Off Gemini safety!
|
|
|
100 |
agent_chain = setup()
|
101 |
|
102 |
user_input = st.text_input("Enter a statement/article title")
|
103 |
+
isChecked = st.checkbox("Enable Debug Mode", value=False, disabled=False, label_visibility="visible")
|
104 |
+
|
105 |
+
global __DEBUG__
|
106 |
+
__DEBUG__ = isChecked
|
107 |
|
108 |
if user_input:
|
109 |
|
|
|
129 |
answers = list()
|
130 |
for source, prompt in prompts:
|
131 |
log(f'prompt=="""{prompt}"""')
|
132 |
+
try:
|
133 |
+
answers.append((source, agent_chain.invoke(prompt)['output']))
|
134 |
+
except:
|
135 |
+
st.write("ERROR: Failed to invoke model for unknown reason...")
|
136 |
+
answers.append((source, "None"))
|
137 |
log(f"answers+={answers[-1]}")
|
138 |
|
139 |
# Get prompt results
|