Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import requests
|
| 3 |
+
|
| 4 |
+
st.title("How AI Thinks: Step-by-Step Math Reasoning")
|
| 5 |
+
|
| 6 |
+
# Input field
|
| 7 |
+
math_problem = st.text_input("Enter a math problem:", "What is 25 + 47?")
|
| 8 |
+
|
| 9 |
+
# Backend URL (Replace with your actual Replit URL)
|
| 10 |
+
BACKEND_URL = "https://your-replit-name.repl.co/solve_math/"
|
| 11 |
+
|
| 12 |
+
if st.button("Solve"):
|
| 13 |
+
with st.spinner("Thinking..."):
|
| 14 |
+
response = requests.post(BACKEND_URL, json={"problem": math_problem})
|
| 15 |
+
|
| 16 |
+
if response.status_code == 200:
|
| 17 |
+
result = response.json()
|
| 18 |
+
st.subheader("AI's Reasoning:")
|
| 19 |
+
st.write(result)
|
| 20 |
+
else:
|
| 21 |
+
st.error("Error: Unable to fetch response.")
|