Spaces:
Running
Running
ashwinpatti
commited on
Commit
·
29f34a8
1
Parent(s):
f03d1da
Update app.py
Browse files
app.py
CHANGED
@@ -69,52 +69,51 @@ def displayResults(results, container):
|
|
69 |
for result in results:
|
70 |
container.header(result['name'])
|
71 |
container.text(f"Language: {result['language']}")
|
72 |
-
container.
|
73 |
cast = ",".join(result['cast'])
|
74 |
-
container.
|
75 |
container.markdown(f'''{result['plot']}''')
|
76 |
-
|
77 |
-
container.markdown(f"""[{result['name']}](https://en.wikipedia.org{result['link']}""",unsafe_allow_html=True)
|
78 |
with container.expander("Movie result internals"):
|
79 |
container.text("JSON Result:")
|
80 |
container.json(result)
|
81 |
container.divider()
|
82 |
|
83 |
st.title("Semantic Indian Movie Search");
|
84 |
-
|
85 |
-
|
86 |
|
87 |
-
st.markdown(
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
top_k = st.slider("Number of Top Hits Generated",min_value=1,max_value=100,value=15)
|
94 |
-
|
95 |
-
#st.subheader(f"Search Query: {query}")
|
96 |
-
search_query = st.text_input("Please enter your search query here",value="",key="text_input")
|
97 |
-
#search = st.button("Search",key='search_but', help='Click to Search!!')
|
98 |
-
ranked_hits = []
|
99 |
-
|
100 |
-
if len(search_query)>0:
|
101 |
-
with st.spinner(
|
102 |
-
text="Searching for relevant movie plots for given query..."
|
103 |
-
):
|
104 |
-
ranked_hits = search(search_query,top_k)
|
105 |
-
if(len(ranked_hits)>0):
|
106 |
-
st.success("Matches found!!")
|
107 |
|
108 |
-
st.
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
-
with
|
118 |
st.header("App details")
|
119 |
|
120 |
st.markdown(
|
|
|
69 |
for result in results:
|
70 |
container.header(result['name'])
|
71 |
container.text(f"Language: {result['language']}")
|
72 |
+
container.text(f"Released in:{result['year']}")
|
73 |
cast = ",".join(result['cast'])
|
74 |
+
container.text(f"Cast:{result['cast']}")
|
75 |
container.markdown(f'''{result['plot']}''')
|
76 |
+
container.markdown(f"""[{result['name']}](https://en.wikipedia.org{result['link']})""",unsafe_allow_html=True)
|
|
|
77 |
with container.expander("Movie result internals"):
|
78 |
container.text("JSON Result:")
|
79 |
container.json(result)
|
80 |
container.divider()
|
81 |
|
82 |
st.title("Semantic Indian Movie Search");
|
83 |
+
appTab, detailsTab = st.tabs(["App", "App Technical Details"])
|
84 |
+
with appTab:
|
85 |
|
86 |
+
st.markdown(
|
87 |
+
"""
|
88 |
+
- Search for movie names based on the plot.
|
89 |
+
- The corpus is made up of Hindi, Telugu, Tamil, Kannada, Bengali, Malayalam, Odiya, Marathi, Punjabi & Gujarathi movies released between 1950 and 2023.
|
90 |
+
- The app understands the context of the query and returns the results from the datastore.""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
|
92 |
+
top_k = st.slider("Number of Top Hits Generated",min_value=1,max_value=100,value=15)
|
93 |
+
|
94 |
+
#st.subheader(f"Search Query: {query}")
|
95 |
+
search_query = st.text_input("Please enter your search query here",value="",key="text_input")
|
96 |
+
#search = st.button("Search",key='search_but', help='Click to Search!!')
|
97 |
+
ranked_hits = []
|
98 |
+
|
99 |
+
if len(search_query)>0:
|
100 |
+
with st.spinner(
|
101 |
+
text="Searching for relevant movie plots for given query..."
|
102 |
+
):
|
103 |
+
ranked_hits = search(search_query,top_k)
|
104 |
+
if(len(ranked_hits)>0):
|
105 |
+
st.success("Matches found!!")
|
106 |
+
|
107 |
+
st.divider()
|
108 |
+
resultContainer = st.container()
|
109 |
+
resultContainer.subheader("Results:")
|
110 |
+
resultContainer.caption(f"Search Query: {search_query}")
|
111 |
+
displayResults(ranked_hits,resultContainer)
|
112 |
+
resultContainer.markdown("\n-------------------------\n")
|
113 |
+
|
114 |
+
st.divider()
|
115 |
|
116 |
+
with detailsTab:
|
117 |
st.header("App details")
|
118 |
|
119 |
st.markdown(
|