Phytgoras commited on
Commit
66aebfa
·
verified ·
1 Parent(s): 05ba334

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -0
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import random
3
+
4
+ teams = [
5
+ "Adana Demirspor", "Alanyaspor", "Antalyaspor", "Beşiktaş", "Bodrum FK",
6
+ "Çaykur Rizespor", "Eyüpspor", "Fenerbahçe", "Galatasaray", "Gaziantep FK",
7
+ "Göztepe", "Hatayspor", "İstanbul Başakşehir", "Kasımpaşa", "Kayserispor",
8
+ "Konyaspor", "Samsunspor", "Sivasspor", "Trabzonspor"
9
+ ]
10
+
11
+ def predict_match(home_team, away_team):
12
+ if home_team == away_team:
13
+ return "Please select two different teams."
14
+
15
+ result = random.choices(
16
+ [f"{home_team} wins", f"{away_team} wins", "Draw"],
17
+ weights=[0.4, 0.4, 0.2],
18
+ k=1
19
+ )[0]
20
+ return result
21
+
22
+ demo = gr.Interface(
23
+ fn=predict_match,
24
+ inputs=[
25
+ gr.Dropdown(teams, label="Home Team"),
26
+ gr.Dropdown(teams, label="Away Team")
27
+ ],
28
+ outputs=gr.Textbox(label="Prediction"),
29
+ title="SuperLig Predictor",
30
+ description="Select two Süper Lig teams to predict the match result."
31
+ )
32
+
33
+ if __name__ == "__main__":
34
+ demo.launch()