| 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']} |
| """ |
|
|
| app = gr.Interface( |
| fn=get_recommendation, |
| inputs=gr.Dropdown(df["title"].tolist()), |
| outputs="text", |
| title="π AI Book Pricing Assistant", |
| description="Select a book to see pricing recommendations." |
| ) |
|
|
| app.launch() |