MuhammadHananKhan123's picture
Update App.py
851e129 verified
import streamlit as st
# App title
st.title("Writing Experimentation Tool")
# Sidebar for selecting experiment mode
st.sidebar.title("Experiment Modes")
mode = st.sidebar.radio(
"Select Mode:",
("Creative Writing", "Essay Writing", "Poetry Generation", "Freeform Writing")
)
# Input text area for user to write
st.header(f"{mode} Mode")
user_input = st.text_area("Start writing here:", placeholder="Type your text here...", height=200)
# Options for enhancements
st.sidebar.header("Enhancements")
show_word_count = st.sidebar.checkbox("Show Word Count")
show_char_count = st.sidebar.checkbox("Show Character Count")
capitalize_toggle = st.sidebar.checkbox("Capitalize First Letter of Each Sentence")
# Display results
if user_input:
st.subheader("Your Writing")
processed_text = user_input.strip()
if capitalize_toggle:
processed_text = ". ".join(sentence.strip().capitalize() for sentence in processed_text.split("."))
st.write(processed_text)
# Display stats
if show_word_count or show_char_count:
st.subheader("Statistics")
if show_word_count:
st.write(f"**Word Count:** {len(user_input.split())}")
if show_char_count:
st.write(f"**Character Count:** {len(user_input)}")
# Footer
st.sidebar.markdown("---")
st.sidebar.markdown("Developed with ❤️ using [Streamlit](https://streamlit.io) and hosted on [Hugging Face Spaces](https://huggingface.co/spaces).")