Spaces:
Sleeping
Sleeping
File size: 1,132 Bytes
1af56e2 8ba7dca 1af56e2 8ba7dca 1af56e2 |
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
from utils import model_prediction
import requests
# set the page config
st.set_page_config(page_title="Sentence Correction", page_icon="📝", layout="centered")
# set the title
st.title("Sentence Correction")
user_input=st.text_area("Enter text: ")
if st.button("Remove Error: "):
response=model_prediction(text=user_input)
st.error(f"Original Text: {user_input}")
st.success(f"Model Prediction: {response}")
# if st.button("Remove Error"):
# with st.status("Hitting the api please wait...."):
# try:
# response=requests.post("http://localhost:8000/predict", json={"text": user_input})
# if response.status_code == 200:
# result = response.json()
# st.error(f"Original Text: {result['original_text']}")
# st.success(f"Model Prediction: {result['corrected_text']}")
# # st.json(result)
# else:
# st.error("Error in fetching prediction from the API.")
# except Exception as e:
# st.write(f"There should be some issue in the api serving {e}")
|