Skip to content

Instantly share code, notes, and snippets.

@nbertagnolli
Last active June 27, 2021 21:39
Show Gist options
  • Save nbertagnolli/3d08215e0b29a5f964e1b70dddb960b5 to your computer and use it in GitHub Desktop.
Save nbertagnolli/3d08215e0b29a5f964e1b70dddb960b5 to your computer and use it in GitHub Desktop.
import streamlit as st
import requests
import json
url = "http://localhost:8000/review/predict"
# Write out the header for the page
st.write("# Movie Review Analyzer")
# Accept user text input
review_text = st.text_input("Paste your movie review here.")
# Make a post request with the text and get a response
response = requests.post(url, headers={}, data={"text": review_text})
review_pred = json.loads(response.text)["sentiment"]
# Display the predicted review
st.success(review_pred)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment