File size: 770 Bytes
6987d13
 
 
 
 
3a4a3e1
6987d13
 
 
 
 
82bb51b
6987d13
 
82bb51b
6987d13
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
import requests
from pydantic import BaseModel

# Define API endpoint
API_ENDPOINT = "https://kubrabuzlu-sentimentandintentionanalysis.hf.space/analyze/"

# Define data model for API request
class Text(BaseModel):
    text: str

# Create Streamlit app
st.title("Text Analysis App")

# Get text from user
input_text = st.text_area("Enter your text here:")

if st.button("Analyze"):
    # Send request
    response = requests.post(API_ENDPOINT, json=Text(text=input_text).dict())

    # Check response
    if response.status_code == 200:
        result = response.json()
        st.write("Sentiment:", result["sentiment"])
        st.write("Intention:", result["intention"])
    else:
        st.error("An error occurred while analyzing the text.")