'}" \\
+--region us-east-1 \\
+--body "{ 'query': '{ title(id: \"tt0120338\") { ratingsSummary { aggregateRating voteCount } } }' }"
+ """,
+ language="bash",
+)
+
+# Sample GraphQL Query
+st.subheader("π» Sample Query")
+st.write("Hereβs a sample GraphQL query to retrieve the IMDb rating for *Titanic*:")
+
+st.markdown(
+ """
+
+{
+ title(id: "tt0120338") {
+ ratingsSummary {
+ aggregateRating
+ voteCount
+ }
+ }
+}
+
+""",
+ unsafe_allow_html=True,
+)
+
+# Response Example
+st.subheader("π Sample API Response")
+st.write('{\n "data": {\n "title": {\n "ratingsSummary": {')
+st.write(' "aggregateRating": 7.9,\n "voteCount": 1133828')
+st.write(" }\n }\n }\n}")
+
+# Additional Code Snippets
+st.subheader("π Additional Code Snippets")
+
+# Code Snippet for Postman Request
+st.write("**Making Requests via Postman**")
+st.markdown(
+ """
+1. **Set Method**: Use `POST` method.
+2. **Request URL**: `https://api-fulfill.dataexchange.us-east-1.amazonaws.com/v1`
+3. **Headers**:
+ - `Content-Type`: `application/json`
+ - `x-api-key`: ``
+4. **Body (GraphQL Query)**:
+ ```graphql
+ {
+ title(id: "tt0120338") {
+ ratingsSummary {
+ aggregateRating
+ voteCount
+ }
+ }
+ }
+ ```
+ """,
+ unsafe_allow_html=True,
+)
+
+# Code Snippet for Python API Call
+st.write("**Python Code to Make an API Call**")
+st.code(
+ """
+import requests
+
+url = "https://api-fulfill.dataexchange.us-east-1.amazonaws.com/v1"
+headers = {
+ "x-api-key": "",
+ "Content-Type": "application/json"
+}
+query = '''
+{
+ title(id: "tt0120338") {
+ ratingsSummary {
+ aggregateRating
+ voteCount
+ }
+ }
+}
+'''
+response = requests.post(url, headers=headers, data=query)
+print(response.json())
+""",
+ language="python",
+)
+
+# Example Use Cases
+st.subheader("π Example Use Cases")
+st.markdown(
+ """
+1. **Retrieve Ratings**: Query title ratings and vote counts.
+2. **Box Office Data**: Access box office gross data.
+3. **Cast and Crew**: Fetch top cast or crew details for movies and shows.
+4. **Search Functionality**: Use keywords to find specific titles or names.
+5. **Real-time Data Access**: Display data updates as they become available on IMDb.
+""",
+ unsafe_allow_html=True,
+)
+
+# Footer
+st.markdown("---")
+st.markdown(
+ "For further assistance, contact support at support@imdbapi.com",
+ unsafe_allow_html=True,
+)
diff --git a/Web_app/pages/ReviewSubmission.py b/Web_app/pages/ReviewSubmission.py
new file mode 100644
index 00000000..e65a55e1
--- /dev/null
+++ b/Web_app/pages/ReviewSubmission.py
@@ -0,0 +1,131 @@
+import streamlit as st
+import os
+import pandas as pd
+
+# Set the path for storing the reviews
+reviews_file = "movie_reviews.csv"
+
+# Initialize the reviews file if it doesn't exist
+if not os.path.exists(reviews_file):
+ df = pd.DataFrame(columns=["Name", "Movie", "Review"])
+ df.to_csv(reviews_file, index=False)
+
+# Read the existing reviews from the file
+df = pd.read_csv(reviews_file)
+
+# Initialize session state for showing the review form
+if "show_review_form" not in st.session_state:
+ st.session_state.show_review_form = False
+
+st.title("π¬ Submit Your Movie Review")
+
+st.markdown(
+ "",
+ unsafe_allow_html=True,
+)
+
+# Updated Custom CSS for Reddit-style reviews with dynamic sizing
+st.markdown(
+ """
+
+ """,
+ unsafe_allow_html=True,
+)
+
+# Toggle for review form visibility
+show_review_form = st.checkbox(
+ "β Submit Review", value=st.session_state.show_review_form, key="review_checkbox"
+)
+
+# Update session state based on checkbox
+st.session_state.show_review_form = show_review_form
+
+# Form for submitting reviews
+if st.session_state.show_review_form:
+ with st.form(key="review_form"):
+ name = st.text_input("Your Name")
+ movie_name = st.text_input("Movie Name")
+ review = st.text_area("Your Review", height=80)
+ submit_button = st.form_submit_button(label="Submit Review")
+
+ if submit_button:
+ if name and movie_name and review:
+ new_review = pd.DataFrame(
+ {
+ "Name": [name],
+ "Movie": [movie_name],
+ "Review": [review],
+ }
+ )
+ df = pd.concat([df, new_review], ignore_index=True)
+ df.to_csv(reviews_file, index=False)
+ st.success("Thank you for your review!")
+ st.session_state.show_review_form = False
+ st.rerun()
+ else:
+ st.error("Please fill in all fields before submitting.")
+
+# Display the reviews in a Reddit-style comment format
+st.subheader("π Reviews")
+
+if not df.empty:
+ for index, row in df.iterrows():
+ st.markdown(
+ f"""
+
+ """,
+ unsafe_allow_html=True,
+ )
+else:
+ st.write("No reviews yet. Be the first to leave one!")