Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import pandas as pd | |
| import sys | |
| sys.path.append("rd2l_pred") | |
| from training_data_prep import list_format, modification, league_money, df_gen | |
| from feature_engineering import heroes, hero_information | |
| def fetch_data(user_id, mmr, comf_1, comf_2, comf_3, comf_4, comf_5): | |
| player_id = user_id.split("/")[-1] | |
| series = {"player_id" : player_id, "mmr" : mmr, "p1" : comf_1, "p2" : comf_2, "p3" : comf_3, "p4" : comf_4, "p5" : comf_5} | |
| money = pd.read_csv("result_money.csv") | |
| print() | |
| print(f"Reading player {player_id}. Starting now") | |
| print(money) | |
| print(money.values) | |
| for item in money.values: | |
| series.update({item[0] : float(item[1])}) | |
| print("Corrected Series") | |
| print(series) | |
| d = pd.Series(series) | |
| print(d) | |
| # This the original section used to add the money section to the series. | |
| # 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']) | |
| # We need to generate the inputs for the sheet using hugging face | |
| # We also need to load the money values from the generated csv file | |
| # df_gen(draft, league_money(captains, data_type), data_type) | |
| print(f"Done reading player {player_id}") | |
| print() | |
| return player_id | |
| demo = gr.Interface( | |
| fn=fetch_data, | |
| inputs=[ | |
| gr.Textbox(label="Player ID or Link to OpenDota/Dotabuff"), | |
| gr.Textbox(label="MMR"), | |
| gr.Slider(1, 5, value=1, step=1, label="Comfort (Pos 1)"), | |
| gr.Slider(1, 5, value=1, step=1, label="Comfort (Pos 2)"), | |
| gr.Slider(1, 5, value=1, step=1, label="Comfort (Pos 3)"), | |
| gr.Slider(1, 5, value=1, step=1, label="Comfort (Pos 4)"), | |
| gr.Slider(1, 5, value=1, step=1, label="Comfort (Pos 5)") | |
| ], | |
| # examples=[ | |
| # [np.asarray(Image.open("examples/1500_maze.jpg")), "Bulge", True, 0.25, 0.5, 0.5, 0.5], | |
| # [np.asarray(Image.open("examples/2048_maze.jpg")), "Bulge", True, 0.25, 0.5, 0.5, 0.5], | |
| # [np.asarray(Image.open("examples/2300_fresh.jpg")), "Bulge", True, 0.25, 0.5, 0.5, 0.5], | |
| # [np.asarray(Image.open("examples/50_fresh.jpg")), "Bulge", True, 0.25, 0.5, 0.5, 0.5] | |
| # ], | |
| outputs=[ | |
| "text" | |
| ], | |
| title="RD2L Pricing Prediction", | |
| article="Uhhhhh this is the article", | |
| description="Uhhhhh this is the description" | |
| ) | |
| demo.launch() | |