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(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) | |
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)") | |
# gr.Image(type="filepath"), | |
# gr.Dropdown(["Pinch", "Spiral", "Shift Up", "Bulge", "Volcano"], value="Bulge", label="Function"), | |
# gr.Checkbox(label="Randomize inputs?"), | |
# gr.Slider(0, 0.5, value=0.25, label="Radius (as fraction of image size)"), | |
# gr.Slider(0, 1, value=0.5, label="Center X"), | |
# gr.Slider(0, 1, value=0.5, label="Center Y"), | |
# gr.Slider(0, 1, value=0.5, label="Strength"), | |
# gr.Slider(0, 1, value=0.5, label="Edge Smoothness"), | |
# gr.Slider(0, 0.5, value=0.1, label="Center Smoothness") | |
# gr.Checkbox(label="Reverse Gradient Direction"), | |
], | |
# 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" | |
# gr.Image(label="Transformed Image"), | |
# gr.Image(label="bulge_model Model Classification"), | |
# gr.Image(label="yolov8n Model Classification"), | |
# gr.Image(label="yolov8x Model Classification"), | |
# gr.Label(), | |
# gr.Label(), | |
# gr.Image(label="Gradient Vector Field"), | |
# gr.Image(label="Inverse Gradient"), | |
# gr.Image(label="Inverted Vector Field"), | |
# gr.Image(label="Fixed Image") | |
], | |
title="RD2L Pricing Prediction", | |
article="Uhhhhh this is the article", | |
description="Uhhhhh this is the description" | |
) | |
demo.launch() | |