Panda70M / app.py
heatingma's picture
Upload 3 files
34a3f57 verified
raw
history blame
1.22 kB
import os
import gradio as gr
from openvideo import push_file_to_hf
try:
import ml4co_kit
except:
os.system("pip install ml4co-kit-0.0.2a1.tar.gz")
import ml4co_kit
from ml4co_kit import CVRPPyVRPSolver
from ml4co_kit import CVRPDataGenerator
FILEPATH = "data/cvrp/uniform/cvrp50_uniform.txt"
def handle(
hf_token: str,
filename: str,
):
solver = CVRPPyVRPSolver(time_limit=10)
gen = CVRPDataGenerator(
num_threads=16,
solver=solver,
train_samples_num=12800,
val_samples_num=0,
test_samples_num=0,
)
gen.generate()
push_file_to_hf(
hf_token=hf_token,
hf_repo_id="ML4CO/ML4VRP",
file_path=FILEPATH,
path_in_repo=filename
)
with gr.Blocks() as demo:
gr.Markdown(
'''
VRP Data Generating
'''
)
hf_token = gr.Textbox(label="HuggingFace Token")
filename = gr.Textbox(label="txt name")
with gr.Row():
button = gr.Button("Submit", variant="primary")
clear = gr.Button("Clear")
button.click(
handle,
[hf_token, filename],
outputs=None
)
if __name__ == "__main__":
demo.launch(debug = True)