Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -59,9 +59,24 @@ 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 |
with gr.Row():
|
62 |
-
|
63 |
-
image_input = gr.Image(label="Upload Image", type="pil",
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
submit_button = gr.Button("Submit")
|
67 |
output = gr.Textbox(label="Recommendations")
|
|
|
59 |
gr.Markdown("# Netflix Recommendation System")
|
60 |
gr.Markdown("Enter a query to receive Netflix show recommendations based on title, description, and genre.")
|
61 |
with gr.Row():
|
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 |
+
image_input.visible = True
|
70 |
+
text_input.visible = False
|
71 |
+
elif input_type == "Text":
|
72 |
+
text_input.visible = True
|
73 |
+
image_input.visible = False
|
74 |
+
elif input_type == "Both":
|
75 |
+
image_input.visible = True
|
76 |
+
text_input.visible = True
|
77 |
+
return image_input, text_input
|
78 |
+
|
79 |
+
input_type.change(fn=update_inputs, inputs=input_type, outputs=[image_input, text_input])
|
80 |
|
81 |
submit_button = gr.Button("Submit")
|
82 |
output = gr.Textbox(label="Recommendations")
|