test / app.py
Shahadbal's picture
Update app.py
da36d06 verified
raw
history blame contribute delete
No virus
1.4 kB
import gradio as gr
def greet_and_recommend(name):
greeting = f"Hello !!"
recommendations = ""
if "books" in name.lower():
recommendations += "\nSince you love books, here are some top recommendations:\n1. 'To Kill a Mockingbird' by Harper Lee\n2. '1984' by George Orwell\n3. 'The Great Gatsby' by F. Scott Fitzgerald\n4. 'Pride and Prejudice' by Jane Austen\n5. 'The Catcher in the Rye' by J.D. Salinger"
if "plays" in name.lower():
recommendations += "\n\nSince you love plays, here are some top recommendations:\n1. 'Hamlet' by William Shakespeare\n2. 'Death of a Salesman' by Arthur Miller\n3. 'A Streetcar Named Desire' by Tennessee Williams\n4. 'Waiting for Godot' by Samuel Beckett\n5. 'The Crucible' by Arthur Miller"
if "songs" in name.lower():
recommendations += "\n\nSince you love songs, here are some top recommendations:\n1. 'Bohemian Rhapsody' by Queen\n2. 'Imagine' by John Lennon\n3. 'Hotel California' by Eagles\n4. 'Stairway to Heaven' by Led Zeppelin\n5. 'Hey Jude' by The Beatles"
if not recommendations:
return greeting
else:
return greeting + "\n" + recommendations
demo = gr.Interface(fn=greet_and_recommend, inputs="text", outputs="text", title="Greet and Recommend", description="Enter your name, and if you love books, plays, or songs, you'll get recommendations!")
demo.launch()