Update app.py
Browse files191 unmodified lines19219319419519619719837 unmodified lines236237238239240241242243244245246247248249250251252253254255256257258134 unmodified lines393394395396397398399400401191 unmodified linesdef process_text(input_text, primary1, synonyms1, primary2, synonyms2, primary3, synonyms3, primary4, synonyms4, primary5, synonyms5):"""Main processing function with added results table"""if not input_text.strip():return "Please enter some text to analyze", "", "", "No keywords found"# Build keywords dictionary from separate inputsprimary_inputs = [primary1, primary2, primary3, primary4, primary5]37 unmodified lines# Create the Gradio interfacedef create_interface():with gr.Blocks(title="Keyword Tagging Tool", theme=gr.themes.Soft()) as demo:gr.Markdown("""# Keyword Tagging ToolThis tool matches text against a controlled vocabulary and returns all associated keywords.Based on the keyword matching logic used for digital humanities research.## How to use:1. **Enter your text** in the left panel2. **Define your keyword dictionary** in the right panel - enter primary keywords and their synonyms3. **Click "Find Keywords"** to see results4. **Copy the results** to paste into your spreadsheet""")with gr.Row():with gr.Column(scale=1):text_input = gr.Textbox(label="Text to Analyze",placeholder="Enter the text you want to tag with keywords...",lines=22,max_lines=25134 unmodified linesgr.HTML("<hr style='margin-top: 40px; margin-bottom: 20px;'>")gr.HTML("""<div style="background-color: #f8f9fa; padding: 20px; border-radius: 8px; margin-top: 20px; text-align: center;"><p style="font-size: 14px; line-height: 1.8; margin: 0;">The code for this tool was built with the aid of Claude Sonnet 4.</p></div>""")191 unmodified lines19219319419519619719837 unmodified lines236237238239240241242243244245246247248249250251252253254255256257258259260134 unmodified lines395396397398399400401402403404405406407408409410191 unmodified linesdef process_text(input_text, primary1, synonyms1, primary2, synonyms2, primary3, synonyms3, primary4, synonyms4, primary5, synonyms5):"""Main processing function with added results table"""if not input_text.strip():return "Please enter some text to analyse", "", "", "No keywords found"# Build keywords dictionary from separate inputsprimary_inputs = [primary1, primary2, primary3, primary4, primary5]37 unmodified lines# Create the Gradio interfacedef create_interface():with gr.Blocks(title="Keyword Tagging Tool", theme=gr.themes.Soft()) as demo:gr.HTML("""<h1>Keyword Tagging Tool</h1><p>This tool matches text against a controlled vocabulary and returns all associated keywords.Based on the keyword matching logic used for digital humanities research.</p><h2>How to use this tool:</h2><ol><li>π <strong>Enter your text</strong> in the left panel</li><li>π <strong>Define your keyword dictionary</strong> in the right panel - enter primary keywords and their synonyms</li><li>π <strong>Click "Find Keywords"</strong> to see results</li><li>π <strong>Copy the results</strong> to paste into your spreadsheet</li></ol>""")with gr.Row():with gr.Column(scale=1):text_input = gr.Textbox(label="Text to Analyse",placeholder="Enter the text you want to tag with keywords...",lines=22,max_lines=25134 unmodified linesgr.HTML("<hr style='margin-top: 40px; margin-bottom: 20px;'>")gr.HTML("""<div style="background-color: #f8f9fa; padding: 20px; border-radius: 8px; margin-top: 20px; text-align: center;"><p style="font-size: 14px; line-height: 1.8; margin: 0;">This <strong>Keyword Tagging Tool</strong> was created as part of the<a href="https://digitalscholarship.web.ox.ac.uk/" target="_blank" style="color: #1976d2;">Digital Scholarship at Oxford (DiSc)</a>funded research project:<br><em>Extracting Keywords from Crowdsourced Collections</em>.</p><br><br><p style="font-size: 14px; line-height: 1.8; margin: 0;">The code for this tool was built with the aid of Claude Opus 4.</p></div>""")
app.py+24-15