Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -58,21 +58,20 @@ def vector_search(query):
|
|
58 |
with gr.Blocks() as demo:
|
59 |
gr.Markdown("# Netflix Recommendation System")
|
60 |
gr.Markdown("Enter a query to receive Netflix show recommendations based on title, description, and genre.")
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
text_input = gr.Textbox(label="Enter Text Query", placeholder="Enter a description or query here", visible=False) # Hidden initially
|
65 |
|
66 |
# Based on the selected input type, make the appropriate input visible
|
67 |
-
|
68 |
if input_type == "Image":
|
69 |
return gr.update(visible=True), gr.update(visible=False)
|
70 |
elif input_type == "Text":
|
71 |
return gr.update(visible=False), gr.update(visible=True)
|
72 |
elif input_type == "Both":
|
73 |
return gr.update(visible=True), gr.update(visible=True)
|
74 |
-
|
75 |
-
|
76 |
input_type.change(fn=update_inputs, inputs=input_type, outputs=[image_input, text_input])
|
77 |
|
78 |
submit_button = gr.Button("Submit")
|
|
|
58 |
with gr.Blocks() as demo:
|
59 |
gr.Markdown("# Netflix Recommendation System")
|
60 |
gr.Markdown("Enter a query to receive Netflix show recommendations based on title, description, and genre.")
|
61 |
+
|
62 |
+
input_type = gr.Radio(["Image", "Text", "Both"], label="Select Input Type", type="value")
|
63 |
+
image_input = gr.Image(label="Upload Image", type="pil", visible=False) # Hidden initially
|
64 |
text_input = gr.Textbox(label="Enter Text Query", placeholder="Enter a description or query here", visible=False) # Hidden initially
|
65 |
|
66 |
# Based on the selected input type, make the appropriate input visible
|
67 |
+
def update_inputs(input_type):
|
68 |
if input_type == "Image":
|
69 |
return gr.update(visible=True), gr.update(visible=False)
|
70 |
elif input_type == "Text":
|
71 |
return gr.update(visible=False), gr.update(visible=True)
|
72 |
elif input_type == "Both":
|
73 |
return gr.update(visible=True), gr.update(visible=True)
|
74 |
+
|
|
|
75 |
input_type.change(fn=update_inputs, inputs=input_type, outputs=[image_input, text_input])
|
76 |
|
77 |
submit_button = gr.Button("Submit")
|