Mo / app.py
Dalablack's picture
Create app.py
6a23bf6 verified
raw
history blame contribute delete
No virus
2.1 kB
import gradio as gr
import pandas as pd
from io import BytesIO
def upload_files(workshop_file, participants_file):
# Save and display workshop itinerary
workshop_path = f"workshop_itinerary.pdf"
with open(workshop_path, "wb") as f:
f.write(workshop_file)
workshop_itinerary = f"Workshop Itinerary uploaded as {workshop_path}"
# Load participant information
participants_df = pd.read_csv(BytesIO(participants_file))
# Calculate profit share
participants = len(participants_df)
rate_per_participant = 75 # Example rate, adjust based on your workshop details
total_earnings = participants * rate_per_participant
earnings_info = f"Total Earnings for the Workshop: ${total_earnings}"
# Provide links to MovNat skills and videos
skills_videos = {
"Supine Lying": "https://www.youtube.com/watch?v=7D_A3LHIxS8",
"Side Roll": "https://www.youtube.com/watch?v=A0KxeAmoPtg",
"Prone Lying": "https://www.youtube.com/watch?v=KhWeLb4XTcY",
"Sit to Backward Roll": "https://www.youtube.com/watch?v=Z3GGSgEO-0M",
"Knee Hand Crawl": "https://www.youtube.com/watch?v=YoOULK3KQTk",
# Add more skills and videos as needed
}
video_links = "\n".join([f"{skill}: {url}" for skill, url in skills_videos.items()])
return workshop_itinerary, participants_df, earnings_info, video_links
# Set up the Gradio interface
interface = gr.Interface(
fn=upload_files,
inputs=[
gr.File(label="Upload MovNat INTRO Workshop Itinerary PDF", type="binary"),
gr.File(label="Upload Participants CSV File", type="binary"),
],
outputs=[
gr.Textbox(label="Workshop Itinerary"),
gr.Dataframe(label="Participant Information"),
gr.Textbox(label="Total Earnings"),
gr.Textbox(label="Links to MovNat Skills and Videos"),
],
title="MovNat Workshop Manager",
description="Upload your MovNat workshop itinerary and participant information to manage your workshop efficiently."
)
# Launch the Gradio interface
interface.launch()