Spaces:
Build error
Build error
| import streamlit as st | |
| import pyperclip | |
| import time | |
| def main(): | |
| st.title("Text Number Prefixer") | |
| # User input for text | |
| user_text = st.text_input("Enter your text:") | |
| # User input for number | |
| number = st.number_input("Select a number between 1 and 100:", min_value=1, max_value=100, value=1) | |
| # Generate the output | |
| output_text = [f"{i+1}{user_text}" for i in range(number)] | |
| # Display the output with copy buttons | |
| for line in output_text: | |
| col1, col2 = st.columns([4, 1]) | |
| with col1: | |
| st.write(line) | |
| with col2: | |
| if st.button(f"Copy {line}"): | |
| pyperclip.copy(line) | |
| st.success(f"{line} copied to clipboard!") | |
| # Copy all text to clipboard sequentially | |
| if st.button("Copy All"): | |
| for line in output_text: | |
| pyperclip.copy(line) | |
| time.sleep(0.1) # Small delay to ensure each copy operation completes | |
| st.success("All text copied to clipboard sequentially!") | |
| if __name__ == "__main__": | |
| main() |