Anshini commited on
Commit
225e45c
·
verified ·
1 Parent(s): 0a307b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -1
app.py CHANGED
@@ -12,7 +12,7 @@ from langgraph.graph.message import add_messages
12
  from typing import Annotated
13
  from typing_extensions import TypedDict
14
  from langchain_together import Together
15
- from tools import execute_python_code
16
  import io
17
  import contextlib
18
  import traceback
@@ -233,6 +233,43 @@ st.markdown("""
233
  """, unsafe_allow_html=True)
234
 
235
  st.title("🧠MitraVerse")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
 
237
  # Initialize session
238
  if "thread_id" not in st.session_state:
 
12
  from typing import Annotated
13
  from typing_extensions import TypedDict
14
  from langchain_together import Together
15
+ from tools import execute_python_code, web_search, deep_think
16
  import io
17
  import contextlib
18
  import traceback
 
233
  """, unsafe_allow_html=True)
234
 
235
  st.title("🧠MitraVerse")
236
+
237
+ st.set_page_config(page_title="Tool Button Executor", layout="wide")
238
+ st.title("🧠 Agent Tools – Run by Button")
239
+
240
+ # User input for all tools
241
+ user_prompt = st.text_area("📝 Enter your prompt / code / query:")
242
+
243
+ # Columns for button layout
244
+ col1, col2, col3 = st.columns(3)
245
+
246
+ # Execution section
247
+ if col1.button("⚙️ Run Python Code"):
248
+ if user_prompt:
249
+ with st.spinner("Executing your Python code..."):
250
+ result = execute_python_code.invoke({"code": user_prompt})
251
+ st.success("✅ Output:")
252
+ st.code(result, language="python")
253
+ else:
254
+ st.warning("Please enter Python code in the input box.")
255
+
256
+ if col2.button("🌐 Web Search"):
257
+ if user_prompt:
258
+ with st.spinner("Searching the web..."):
259
+ result = web_search.invoke({"query": user_prompt})
260
+ st.success("🔎 Search Result:")
261
+ st.write(result)
262
+ else:
263
+ st.warning("Please enter a search query.")
264
+
265
+ if col3.button("🧠 Deep Think"):
266
+ if user_prompt:
267
+ with st.spinner("Thinking deeply..."):
268
+ result = deep_think.invoke({"prompt": user_prompt})
269
+ st.success("🧠 Reasoned Output:")
270
+ st.write(result)
271
+ else:
272
+ st.warning("Please enter a prompt.")
273
 
274
  # Initialize session
275
  if "thread_id" not in st.session_state: