AI-Quotient commited on
Commit
7e89de8
·
verified ·
1 Parent(s): a0a3d01

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -6
app.py CHANGED
@@ -100,18 +100,27 @@ for tool in sympy_tools:
100
  builder = create_agent(llm, tool_registry)
101
  agent = builder.compile(store=store)
102
 
103
-
104
-
105
-
 
 
 
 
 
 
 
 
 
106
 
107
  iface = gr.Interface(
108
  fn=pvsnp,
109
  inputs=gr.Textbox(label="What problem would you like to classify as P or NP?"),
110
  outputs=gr.Markdown(label="Agent's response"), # Output as HTML
111
- title="PolyProb",
112
- description="PolyProb is an advanced AI agent that guides users through the intricate maze of computational complexity. This agent scrutinizes problem descriptions with sophisticated LLM prompts and symbolic reasoning. It classifies problems into categories such as P, NP, NP-complete, NP-hard, or beyond (e.g., PSPACE, EXPTIME), while providing clear, concise explanations of its reasoning. As part of AI Quotient’s Millennium Math Challenge, it is the first step towards solving the P vs NP problem.",
113
  theme = gr.themes.Ocean(),
114
- examples = ["Can you find a path that visits each node exactly once in a given graph?", "How efficiently can two nXn matrices be multiplied?", "Is there a subset of given numbers that sums to a target value?"]
115
  )
116
 
117
  # Launch the app
 
100
  builder = create_agent(llm, tool_registry)
101
  agent = builder.compile(store=store)
102
 
103
+ def pvsnp(problem):
104
+ output = []
105
+ for step in agent.stream(
106
+ {"messages": "Use tools to answer:"+problem},
107
+ stream_mode="updates",
108
+ ):
109
+ for _, update in step.items():
110
+ for message in update.get("messages", []):
111
+ message.pretty_print()
112
+ output.append(message.pretty_print())
113
+ return output
114
+
115
 
116
  iface = gr.Interface(
117
  fn=pvsnp,
118
  inputs=gr.Textbox(label="What problem would you like to classify as P or NP?"),
119
  outputs=gr.Markdown(label="Agent's response"), # Output as HTML
120
+ title="PolyMath",
121
+ description="PolyMath is an advanced AI agent that guides users through the intricate maze of computational complexity. This agent scrutinizes problem descriptions with sophisticated LLM prompts and symbolic reasoning. It classifies problems into categories such as P, NP, NP-complete, NP-hard, or beyond (e.g., PSPACE, EXPTIME), while providing clear, concise explanations of its reasoning. As part of AI Quotient’s Millennium Math Challenge, it is the first step towards solving the P vs NP problem.",
122
  theme = gr.themes.Ocean(),
123
+ examples = ["Simplify x*2+2x+1"]
124
  )
125
 
126
  # Launch the app