Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| import pandas as pd | |
| df = pd.read_csv("final_recommendations.csv") | |
| def get_recommendation(book): | |
| row = df[df["title"] == book].iloc[0] | |
| return f"""Title: {row['title']} | |
| Price: {row['price_gbp']} | |
| Revenue: {row['total_revenue']} | |
| Recommendation: {row['recommendation']}""" | |
| demo = gr.Interface( | |
| fn=get_recommendation, | |
| inputs=gr.Dropdown(choices=df["title"].tolist(), label="Choose a book"), | |
| outputs=gr.Textbox(label="Recommendation"), | |
| title="AI Book Pricing Assistant", | |
| description="Select a book to view its pricing recommendation." | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() |