Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import sympy as sp
|
3 |
+
from transformers import pipeline
|
4 |
+
|
5 |
+
# Load NLP Model
|
6 |
+
model = pipeline("text2text-generation", model="facebook/bart-large")
|
7 |
+
|
8 |
+
st.title("π€ AI-Driven Mathematical Model Generator")
|
9 |
+
st.write("Enter a problem statement in natural language to get a mathematical model.")
|
10 |
+
|
11 |
+
user_input = st.text_area("βοΈ Enter your problem:")
|
12 |
+
|
13 |
+
if st.button("π Generate Model"):
|
14 |
+
response = model(user_input, max_length=200)
|
15 |
+
equation = sp.sympify(response[0]['generated_text'])
|
16 |
+
|
17 |
+
st.subheader("π Mathematical Model:")
|
18 |
+
st.latex(sp.latex(equation))
|
19 |
+
st.code(str(equation), language='python')
|