import streamlit as st import requests st.title("Kyrgyz Language Classifier") st.write("This tool identifies whether the given text is Kyrgyz or not.") st.markdown(""" **Instructions:** * Please enter a **sentence** or a few sentences for better accuracy. * **Note:** The word "**Салам**" might be classified as Non-Kyrgyz. This is a known exception. """) user_input = st.text_area("Enter text to classify:", placeholder="Type your sentence here...") api_url = "https://4190-212-112-100-194.ngrok-free.app//classify" if st.button("Classify"): if user_input.strip(): try: response = requests.post(api_url, json={'text': user_input}) response.raise_for_status() # Raise an exception for bad status codes result = response.json() if 'error' in result: st.error(f"Error: {result['error']}") else: st.write(f"Prediction: **{result['label']}**") st.write(f"Confidence: **{result['confidence']:.2%}**") except requests.exceptions.RequestException as e: st.error(f"Connection error: {e}") else: st.warning("Please enter some text for classification.")