Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -84,7 +84,7 @@ Semantic Search is a way to generate search results based on the actual meaning
|
|
84 |
|
85 |
Enjoy and Search like you mean it!!
|
86 |
"""
|
87 |
-
|
88 |
|
89 |
twitter_link = """
|
90 |
[](https://twitter.com/nickmuchi)
|
@@ -99,40 +99,41 @@ h1#title {
|
|
99 |
demo = gr.Blocks(css=css)
|
100 |
|
101 |
with demo:
|
102 |
-
gr.
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
top_k = gr.Slider(minimum=3,maximum=10,value=5,step=1,label='Number of Suggestions to Generate')
|
107 |
-
|
108 |
-
|
109 |
-
with gr.Row():
|
110 |
-
audio = gr.Audio(source='microphone',type='filepath',label='Audio Input: Describe the Netflix show you would like to watch..')
|
111 |
-
|
112 |
-
with gr.Row():
|
113 |
-
query = gr.Textbox(label='Transcribed Text')
|
114 |
-
audio.change(asr,audio,query)
|
115 |
-
|
116 |
-
with gr.Row():
|
117 |
-
|
118 |
-
bi_output = gr.DataFrame(headers=['Similarity Score','Type','Title','Country','Description','Release Year','Rating','Duration','Category Listing','Cast'],
|
119 |
-
label=f'Top-{top_k} Bi-Encoder Retrieval hits', wrap=True)
|
120 |
-
|
121 |
-
with gr.Row():
|
122 |
-
|
123 |
-
cross_output = gr.DataFrame(headers=['Similarity Score','Type','Title','Country','Description','Release Year','Rating','Duration','Category Listing','Cast'],
|
124 |
-
label=f'Top-{top_k} Cross-Encoder Re-ranker hits', wrap=True)
|
125 |
|
126 |
-
|
127 |
-
examples = gr.Examples(examples=example_queries,inputs=[query])
|
128 |
|
129 |
|
130 |
-
|
131 |
-
|
132 |
|
133 |
-
|
134 |
-
|
135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
|
138 |
demo.launch(debug=True,enable_queue=True)
|
|
|
84 |
|
85 |
Enjoy and Search like you mean it!!
|
86 |
"""
|
87 |
+
example_audio = [[path.as_posix()] for path in sorted(pathlib.Path('audio_examples').rglob('*.wav'))]
|
88 |
|
89 |
twitter_link = """
|
90 |
[](https://twitter.com/nickmuchi)
|
|
|
99 |
demo = gr.Blocks(css=css)
|
100 |
|
101 |
with demo:
|
102 |
+
with gr.Box():
|
103 |
+
gr.Markdown(title)
|
104 |
+
gr.Markdown(description)
|
105 |
+
gr.Markdown(twitter_link)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
+
top_k = gr.Slider(minimum=3,maximum=10,value=5,step=1,label='Number of Suggestions to Generate')
|
|
|
108 |
|
109 |
|
110 |
+
with gr.Row():
|
111 |
+
audio = gr.Audio(source='microphone',type='filepath',label='Audio Input: Describe the Netflix show you would like to watch..')
|
112 |
|
113 |
+
with gr.Row():
|
114 |
+
query = gr.Textbox(label='Transcribed Text')
|
115 |
+
audio.change(asr,audio,query)
|
116 |
+
|
117 |
+
with gr.Row():
|
118 |
+
|
119 |
+
bi_output = gr.DataFrame(headers=['Similarity Score','Type','Title','Country','Description','Release Year','Rating','Duration','Category Listing','Cast'],
|
120 |
+
label=f'Top-{top_k} Bi-Encoder Retrieval hits', wrap=True)
|
121 |
+
|
122 |
+
with gr.Row():
|
123 |
+
|
124 |
+
cross_output = gr.DataFrame(headers=['Similarity Score','Type','Title','Country','Description','Release Year','Rating','Duration','Category Listing','Cast'],
|
125 |
+
label=f'Top-{top_k} Cross-Encoder Re-ranker hits', wrap=True)
|
126 |
+
|
127 |
+
with gr.Row():
|
128 |
+
examples = gr.Examples(examples=example_audio,inputs=[query])
|
129 |
+
|
130 |
+
|
131 |
+
sem_but = gr.Button('Search')
|
132 |
+
|
133 |
+
|
134 |
+
sem_but.click(semantic_search,inputs=[query,top_k],outputs=[bi_output,cross_output],queue=True)
|
135 |
+
|
136 |
+
gr.Markdown("")
|
137 |
|
138 |
|
139 |
demo.launch(debug=True,enable_queue=True)
|