import os from transformers import pipeline import streamlit as st '''port = int(os.environ.get("PORT", 7860)) st.set_page_config(page_title="Text Classifier") st.write(f"Running on port {port} (for Hugging Face)") ''' # Use local cache directory to avoid permission issues ##os.environ['TRANSFORMERS_CACHE'] = '/app/cache' # Create zero-shot classification pipeline ##classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli") # Streamlit UI st.title("Zero-Shot Text Classifier") text = st.text_area("Enter text to classify") labels = st.text_input("Enter candidate labels (comma-separated)", "finance, education, health") ''' if st.button("Classify"): if text and labels: label_list = [l.strip() for l in labels.split(",")] result = classifier(text, candidate_labels=label_list) st.write(result) else: st.warning("Please enter both text and labels.") '''