Spaces:
Configuration error
Configuration error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,15 @@
|
|
| 1 |
-
import sys
|
| 2 |
import os
|
| 3 |
import streamlit as st
|
|
|
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
# Streamlit app configuration
|
| 12 |
st.set_page_config(page_title="Damru Sloka Simplifier", layout="centered")
|
|
@@ -15,40 +18,28 @@ st.set_page_config(page_title="Damru Sloka Simplifier", layout="centered")
|
|
| 15 |
st.title("🪘 Damru Sloka Simplifier")
|
| 16 |
st.write("""
|
| 17 |
Enter a Vedic sloka or stotra, and this bot will:
|
| 18 |
-
1.
|
| 19 |
-
2. Generate a Damru-shaped graph representing the cosmic relationships.
|
| 20 |
""")
|
| 21 |
|
| 22 |
# User input
|
| 23 |
-
user_input = st.text_area("Enter Vedic Sloka or Stotra",
|
| 24 |
-
placeholder="E.g., Black Hole, Wormhole, Singularity...")
|
| 25 |
|
| 26 |
# Generate output when the button is clicked
|
| 27 |
if st.button("Process Sloka"):
|
| 28 |
if not user_input.strip():
|
| 29 |
st.error("Please enter a valid sloka or stotra.")
|
| 30 |
else:
|
| 31 |
-
# Simplify the sloka
|
| 32 |
-
status, simplified_meanings = simplify_sloka(user_input)
|
| 33 |
-
if status == "Simplified meanings extracted successfully.":
|
| 34 |
-
st.success(status)
|
| 35 |
-
st.write("### Simplified Meanings:")
|
| 36 |
-
for symbol, meaning in simplified_meanings.items():
|
| 37 |
-
st.write(f"**{symbol}:** {meaning}")
|
| 38 |
-
else:
|
| 39 |
-
st.warning(status)
|
| 40 |
-
|
| 41 |
# Generate the graph
|
| 42 |
-
output_path = "images/
|
| 43 |
if not os.path.exists("images"):
|
| 44 |
os.makedirs("images")
|
| 45 |
|
| 46 |
-
graph_status =
|
| 47 |
|
| 48 |
if graph_status == "Graph generated successfully":
|
| 49 |
st.write("### Graphical Representation:")
|
| 50 |
if os.path.exists(output_path):
|
| 51 |
-
st.image(output_path, caption="
|
| 52 |
else:
|
| 53 |
st.error("Error: Graph image could not be found.")
|
| 54 |
else:
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import streamlit as st
|
| 3 |
+
import matplotlib.pyplot as plt
|
| 4 |
|
| 5 |
+
# Create a simple graph for testing
|
| 6 |
+
def generate_test_graph(output_path):
|
| 7 |
+
# Simple plot for testing
|
| 8 |
+
fig, ax = plt.subplots(figsize=(6, 6))
|
| 9 |
+
ax.plot([1, 2, 3], [4, 5, 6])
|
| 10 |
+
ax.set_title("Test Graph")
|
| 11 |
+
fig.savefig(output_path)
|
| 12 |
+
return "Graph generated successfully"
|
| 13 |
|
| 14 |
# Streamlit app configuration
|
| 15 |
st.set_page_config(page_title="Damru Sloka Simplifier", layout="centered")
|
|
|
|
| 18 |
st.title("🪘 Damru Sloka Simplifier")
|
| 19 |
st.write("""
|
| 20 |
Enter a Vedic sloka or stotra, and this bot will:
|
| 21 |
+
1. Generate a simple test graph as a placeholder for the Damru graph.
|
|
|
|
| 22 |
""")
|
| 23 |
|
| 24 |
# User input
|
| 25 |
+
user_input = st.text_area("Enter Vedic Sloka or Stotra", placeholder="E.g., Black Hole, Wormhole, Singularity...")
|
|
|
|
| 26 |
|
| 27 |
# Generate output when the button is clicked
|
| 28 |
if st.button("Process Sloka"):
|
| 29 |
if not user_input.strip():
|
| 30 |
st.error("Please enter a valid sloka or stotra.")
|
| 31 |
else:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
# Generate the graph
|
| 33 |
+
output_path = "images/test_graph.png"
|
| 34 |
if not os.path.exists("images"):
|
| 35 |
os.makedirs("images")
|
| 36 |
|
| 37 |
+
graph_status = generate_test_graph(output_path)
|
| 38 |
|
| 39 |
if graph_status == "Graph generated successfully":
|
| 40 |
st.write("### Graphical Representation:")
|
| 41 |
if os.path.exists(output_path):
|
| 42 |
+
st.image(output_path, caption="Test Graph")
|
| 43 |
else:
|
| 44 |
st.error("Error: Graph image could not be found.")
|
| 45 |
else:
|