import gradio as gr def calculate_selling_price(daily_circulation, annual_expenses, days_sold): try: # Calculate the selling price per copy selling_price = annual_expenses / (daily_circulation * days_sold) return f"₹{selling_price:.2f} per copy" except ZeroDivisionError: return "Invalid input: Daily circulation and days sold must be greater than zero." def concept_summary(): summary = ( "**Concept: Applying Print Economics to Digital News**\n\n" "In print media, unit economics are straightforward: \n" "Selling Price = Annual Expenses / (Daily Circulation × Days Sold).\n\n" "For digital news, while it eliminates printing costs, new challenges arise:\n" "- High fixed costs like servers and technology.\n" "- A smaller paying subscriber base.\n\n" "Example for Digital:\n" "If annual expenses are ₹500 crores and there are 10 lakh subscribers,\n" "Subscription Price = ₹500,00,00,000 / 10,00,000 = ₹5000/year (~₹417/month).\n\n" "Conclusion: Digital news is undoubtedly the future, but relying solely on subscription revenue is \n" "as impractical for digital as it is for print. Just as print media relies on a mix of subscription, \n" "advertising, and sponsorships, digital news platforms must adopt hybrid models \n" "(ads + subscription + partnerships) to remain sustainable." ) return summary # Gradio interface interface = gr.Interface( fn=calculate_selling_price, inputs=[ gr.Number(label="Daily Circulation (e.g., 1000000 for 10 lakh copies)"), gr.Number(label="Annual Expenses (in ₹, e.g., 900000000 for ₹900 crores)"), gr.Number(label="Days Sold (e.g., 360)") ], outputs=gr.Textbox(label="Selling Price per Copy"), examples=[[1000000, 900000000, 360]], title="Newspaper Selling Price Calculator", description=( "This calculator helps determine the selling price per copy of a newspaper based on its " "daily circulation, annual expenses, and the number of days it is sold in a year.\n\n" + concept_summary() ) ) if __name__ == "__main__": interface.launch()