File size: 1,212 Bytes
3dda396
2b68ebe
3dda396
 
 
 
 
 
 
2b68ebe
3dda396
 
 
 
2b68ebe
 
 
3dda396
 
2b68ebe
 
 
 
 
 
 
 
 
 
 
 
3dda396
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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.")