Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def calculate_selling_price(daily_circulation, annual_expenses, days_sold):
|
| 4 |
+
try:
|
| 5 |
+
# Calculate the selling price per copy
|
| 6 |
+
selling_price = annual_expenses / (daily_circulation * days_sold)
|
| 7 |
+
return f"₹{selling_price:.2f} per copy"
|
| 8 |
+
except ZeroDivisionError:
|
| 9 |
+
return "Invalid input: Daily circulation and days sold must be greater than zero."
|
| 10 |
+
|
| 11 |
+
def concept_summary():
|
| 12 |
+
summary = (
|
| 13 |
+
"**Concept: Applying Print Economics to Digital News**\n\n"
|
| 14 |
+
"In print media, unit economics are straightforward: \n"
|
| 15 |
+
"Selling Price = Annual Expenses / (Daily Circulation × Days Sold).\n\n"
|
| 16 |
+
"For digital news, while it eliminates printing costs, new challenges arise:\n"
|
| 17 |
+
"- High fixed costs like servers and technology.\n"
|
| 18 |
+
"- A smaller paying subscriber base.\n\n"
|
| 19 |
+
"Example for Digital:\n"
|
| 20 |
+
"If annual expenses are ₹500 crores and there are 10 lakh subscribers,\n"
|
| 21 |
+
"Subscription Price = ₹500,00,00,000 / 10,00,000 = ₹5000/year (~₹417/month).\n\n"
|
| 22 |
+
"Conclusion: Digital news is undoubtedly the future, but relying solely on subscription revenue is \n"
|
| 23 |
+
"as impractical for digital as it is for print. Just as print media relies on a mix of subscription, \n"
|
| 24 |
+
"advertising, and sponsorships, digital news platforms must adopt hybrid models \n"
|
| 25 |
+
"(ads + subscription + partnerships) to remain sustainable."
|
| 26 |
+
)
|
| 27 |
+
return summary
|
| 28 |
+
|
| 29 |
+
# Gradio interface
|
| 30 |
+
interface = gr.Interface(
|
| 31 |
+
fn=calculate_selling_price,
|
| 32 |
+
inputs=[
|
| 33 |
+
gr.Number(label="Daily Circulation (e.g., 1000000 for 10 lakh copies)"),
|
| 34 |
+
gr.Number(label="Annual Expenses (in ₹, e.g., 900000000 for ₹900 crores)"),
|
| 35 |
+
gr.Number(label="Days Sold (e.g., 360)")
|
| 36 |
+
],
|
| 37 |
+
outputs=gr.Textbox(label="Selling Price per Copy"),
|
| 38 |
+
examples=[[1000000, 900000000, 360]],
|
| 39 |
+
title="Newspaper Selling Price Calculator",
|
| 40 |
+
description=(
|
| 41 |
+
"This calculator helps determine the selling price per copy of a newspaper based on its "
|
| 42 |
+
"daily circulation, annual expenses, and the number of days it is sold in a year.\n\n"
|
| 43 |
+
+ concept_summary()
|
| 44 |
+
)
|
| 45 |
+
)
|
| 46 |
+
|
| 47 |
+
if __name__ == "__main__":
|
| 48 |
+
interface.launch()
|
| 49 |
+
|