Spaces:
Runtime error
Runtime error
| import streamlit as st | |
| from transformers import pipeline | |
| # Configure the page | |
| st.set_page_config(page_title="Freelance Contract Guard", page_icon="🛡️") | |
| st.title("🛡️ Freelance Contract Guard") | |
| st.markdown(""" | |
| Analyze your freelance contracts for risky **Non-Compete** clauses. | |
| This tool uses a fine-tuned BERT model to identify predatory language. | |
| """) | |
| # Load your model from the Hub | |
| def load_model(): | |
| # Linking to your specific repository | |
| return pipeline("text-classification", model="Musadiq7860/contract-guard-ai") | |
| classifier = load_model() | |
| # UI Input | |
| user_text = st.text_area("Paste a contract clause here:", height=200, placeholder="e.g., The freelancer shall not provide services to any competitor...") | |
| if st.button("Check for Risk"): | |
| if user_text.strip(): | |
| with st.spinner("Analyzing legal risks..."): | |
| result = classifier(user_text)[0] | |
| label = result['label'] | |
| score = result['score'] | |
| # Assuming LABEL_1 is your 'Risky' class from training | |
| if label == "LABEL_1": | |
| st.error(f"⚠️ **RISK DETECTED:** This looks like a Non-Compete clause! (Confidence: {score:.2f})") | |
| st.info("💡 Non-compete clauses can limit your future work. You may want to negotiate this section.") | |
| else: | |
| st.success(f"✅ **SAFE:** No non-compete detected. (Confidence: {score:.2f})") | |
| else: | |
| st.warning("Please enter some text to analyze.") |