nick-leland commited on
Commit
7409f0d
·
1 Parent(s): d804135

Weekend work on the gradio interface

Browse files
Files changed (1) hide show
  1. app.py +33 -10
app.py CHANGED
@@ -1,26 +1,49 @@
1
  import gradio as gr
 
2
  import sys
3
  sys.path.append("rd2l_pred")
4
  from training_data_prep import list_format, modification, league_money, df_gen
 
5
 
6
- def greet(name):
7
- return "Hello " + name + "!!"
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
- def fetch_data(user_input):
11
  # We need to generate the inputs for the sheet using hugging face
12
  # We also need to load the money values from the generated csv file
13
- df_gen(draft, league_money(captains, data_type), data_type)
14
- return
15
-
16
- # Needs a text input for dotabuff link
17
 
 
18
 
19
- demo = gr.Interface(fn=greet, inputs="textbox", outputs="text")
20
  demo = gr.Interface(
21
- fn=greet,
22
  inputs=[
23
- "textbox"
 
 
 
 
 
 
24
  # gr.Image(type="filepath"),
25
  # gr.Dropdown(["Pinch", "Spiral", "Shift Up", "Bulge", "Volcano"], value="Bulge", label="Function"),
26
  # gr.Checkbox(label="Randomize inputs?"),
 
1
  import gradio as gr
2
+ import pandas as pd
3
  import sys
4
  sys.path.append("rd2l_pred")
5
  from training_data_prep import list_format, modification, league_money, df_gen
6
+ from feature_engineering import heroes, hero_information
7
 
 
 
8
 
9
+ def fetch_data(user_id, mmr, comf_1, comf_2, comf_3, comf_4, comf_5):
10
+ player_id = user_id.split("/")[-1]
11
+
12
+ series = {"player_id" : player_id, "mmr" : mmr, "p1" : comf_1, "p2" : comf_2, "p3" : comf_3, "p4" : comf_4, "p5" : comf_5}
13
+
14
+ money = pd.read_csv("result_money.csv")
15
+
16
+ print(money)
17
+ print(money.values)
18
+
19
+ for item in money.values:
20
+ series.update({item[0] : float(item[1])})
21
+
22
+ print("Corrected Series")
23
+ print(series)
24
+
25
+ d = pd.Series(series)
26
+ print(d)
27
+
28
+ # This the original section used to add the money section to the series.
29
+ # d = d.assign(count=lambda x: money[player_season].loc['count'], mean=lambda x: money[player_season].loc['mean'], std=lambda x: money[player_season].loc['std'], min=lambda x: money[player_season].loc['min'], max=lambda x: money[player_season].loc['max'], sum=lambda x: money[player_season].loc['sum'])
30
 
 
31
  # We need to generate the inputs for the sheet using hugging face
32
  # We also need to load the money values from the generated csv file
33
+ # df_gen(draft, league_money(captains, data_type), data_type)
 
 
 
34
 
35
+ return player_id
36
 
 
37
  demo = gr.Interface(
38
+ fn=fetch_data,
39
  inputs=[
40
+ gr.Textbox(label="Player ID or Link to OpenDota/Dotabuff"),
41
+ gr.Textbox(label="MMR"),
42
+ gr.Slider(1, 5, value=1, step=1, label="Comfort (Pos 1)"),
43
+ gr.Slider(1, 5, value=1, step=1, label="Comfort (Pos 2)"),
44
+ gr.Slider(1, 5, value=1, step=1, label="Comfort (Pos 3)"),
45
+ gr.Slider(1, 5, value=1, step=1, label="Comfort (Pos 4)"),
46
+ gr.Slider(1, 5, value=1, step=1, label="Comfort (Pos 5)")
47
  # gr.Image(type="filepath"),
48
  # gr.Dropdown(["Pinch", "Spiral", "Shift Up", "Bulge", "Volcano"], value="Bulge", label="Function"),
49
  # gr.Checkbox(label="Randomize inputs?"),