Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import pandas as pd
|
| 3 |
+
from io import BytesIO
|
| 4 |
+
|
| 5 |
+
def upload_files(workshop_file, participants_file):
|
| 6 |
+
# Save and display workshop itinerary
|
| 7 |
+
workshop_path = f"workshop_itinerary.pdf"
|
| 8 |
+
with open(workshop_path, "wb") as f:
|
| 9 |
+
f.write(workshop_file)
|
| 10 |
+
workshop_itinerary = f"Workshop Itinerary uploaded as {workshop_path}"
|
| 11 |
+
|
| 12 |
+
# Load participant information
|
| 13 |
+
participants_df = pd.read_csv(BytesIO(participants_file))
|
| 14 |
+
|
| 15 |
+
# Calculate profit share
|
| 16 |
+
participants = len(participants_df)
|
| 17 |
+
rate_per_participant = 75 # Example rate, adjust based on your workshop details
|
| 18 |
+
total_earnings = participants * rate_per_participant
|
| 19 |
+
earnings_info = f"Total Earnings for the Workshop: ${total_earnings}"
|
| 20 |
+
|
| 21 |
+
# Provide links to MovNat skills and videos
|
| 22 |
+
skills_videos = {
|
| 23 |
+
"Supine Lying": "https://www.youtube.com/watch?v=7D_A3LHIxS8",
|
| 24 |
+
"Side Roll": "https://www.youtube.com/watch?v=A0KxeAmoPtg",
|
| 25 |
+
"Prone Lying": "https://www.youtube.com/watch?v=KhWeLb4XTcY",
|
| 26 |
+
"Sit to Backward Roll": "https://www.youtube.com/watch?v=Z3GGSgEO-0M",
|
| 27 |
+
"Knee Hand Crawl": "https://www.youtube.com/watch?v=YoOULK3KQTk",
|
| 28 |
+
# Add more skills and videos as needed
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
video_links = "\n".join([f"{skill}: {url}" for skill, url in skills_videos.items()])
|
| 32 |
+
|
| 33 |
+
return workshop_itinerary, participants_df, earnings_info, video_links
|
| 34 |
+
|
| 35 |
+
# Set up the Gradio interface
|
| 36 |
+
interface = gr.Interface(
|
| 37 |
+
fn=upload_files,
|
| 38 |
+
inputs=[
|
| 39 |
+
gr.File(label="Upload MovNat INTRO Workshop Itinerary PDF", type="binary"),
|
| 40 |
+
gr.File(label="Upload Participants CSV File", type="binary"),
|
| 41 |
+
],
|
| 42 |
+
outputs=[
|
| 43 |
+
gr.Textbox(label="Workshop Itinerary"),
|
| 44 |
+
gr.Dataframe(label="Participant Information"),
|
| 45 |
+
gr.Textbox(label="Total Earnings"),
|
| 46 |
+
gr.Textbox(label="Links to MovNat Skills and Videos"),
|
| 47 |
+
],
|
| 48 |
+
title="MovNat Workshop Manager",
|
| 49 |
+
description="Upload your MovNat workshop itinerary and participant information to manage your workshop efficiently."
|
| 50 |
+
)
|
| 51 |
+
|
| 52 |
+
# Launch the Gradio interface
|
| 53 |
+
interface.launch()
|