JHigg commited on
Commit
04d625a
·
verified ·
1 Parent(s): 625d044

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import gradio as gr
3
+
4
+ # Load the injury data
5
+ data = pd.read_csv("Injury_History.csv")
6
+
7
+ # Define a function to look up injuries by player name
8
+ def lookup_injuries(player_name):
9
+ # Filter injury data for the given player name
10
+ injuries = data[data['Name'].str.lower() == player_name.lower()]
11
+ if injuries.empty:
12
+ return f"No injury records found for {player_name}."
13
+
14
+ # Format the output to show only Date and Notes columns
15
+ return injuries[['Date', 'Notes']].to_string(index=False)
16
+
17
+ # Set up the Gradio interface
18
+ interface = gr.Interface(
19
+ fn=lookup_injuries,
20
+ inputs="text",
21
+ outputs="text",
22
+ title="NBA Player Injury Lookup",
23
+ description="Enter a player's name to see their injury history."
24
+ )
25
+
26
+ # Launch the app
27
+ interface.launch()