Spaces:
Configuration error
Configuration error
| import os | |
| import streamlit as st | |
| import matplotlib.pyplot as plt | |
| # Create a simple graph for testing | |
| def generate_test_graph(output_path): | |
| # Simple plot for testing | |
| fig, ax = plt.subplots(figsize=(6, 6)) | |
| ax.plot([1, 2, 3], [4, 5, 6]) | |
| ax.set_title("Test Graph") | |
| fig.savefig(output_path) | |
| return "Graph generated successfully" | |
| # Streamlit app configuration | |
| st.set_page_config(page_title="Damru Sloka Simplifier", layout="centered") | |
| # Title and description | |
| st.title("🪘 Damru Sloka Simplifier") | |
| st.write(""" | |
| Enter a Vedic sloka or stotra, and this bot will: | |
| 1. Generate a simple test graph as a placeholder for the Damru graph. | |
| """) | |
| # User input | |
| user_input = st.text_area("Enter Vedic Sloka or Stotra", placeholder="E.g., Black Hole, Wormhole, Singularity...") | |
| # Generate output when the button is clicked | |
| if st.button("Process Sloka"): | |
| if not user_input.strip(): | |
| st.error("Please enter a valid sloka or stotra.") | |
| else: | |
| # Generate the graph | |
| output_path = "images/test_graph.png" | |
| if not os.path.exists("images"): | |
| os.makedirs("images") | |
| graph_status = generate_test_graph(output_path) | |
| if graph_status == "Graph generated successfully": | |
| st.write("### Graphical Representation:") | |
| if os.path.exists(output_path): | |
| st.image(output_path, caption="Test Graph") | |
| else: | |
| st.error("Error: Graph image could not be found.") | |
| else: | |
| st.error("No valid symbols found for the graph.") | |