File size: 1,484 Bytes
fae4ef9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
df42772
fae4ef9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# A3C++ a modified version of Asynchronous Advantage actor critic algorithm
# -----------------------------------
#
# A3C paper: https://arxiv.org/abs/1602.01783
#
# The A3C implementation is available at:
# https://jaromiru.com/2017/02/16/lets-make-an-a3c-theory/
# by: Jaromir Janisch, 2017

# Two variations are implemented: A memory replay and a deterministic search following argmax(pi) instead of pi as a probability distribution
# Every action selection is made following the action with the highest probability pi

# Author: Taha Nakabi

# Args: 'train' for training the model anything else will skip the training and try to use already saved models


import gradio as gr
from gradio.components import *

import subprocess

def main(use_default, file):

    subprocess.run(['python', './A3C_plusplus.py'])


    base = './RESULT/'
    img_path = []
    for i in range(1, 11):
        img_path.append(base + 'Day' + str(i) + '.png')
    # else:
    # 根据上传的文件执行相应的逻辑
    # 请根据您的实际需求自行编写代码

    return [img for img in img_path]

# 创建一个复选框来表示是否选择默认文件
default_checkbox = gr.inputs.Checkbox(label="使用默认文件", default=False)

inputs = [
    default_checkbox,
    File(label="上传文件", optional=True)
]
outputs = [
    Image(label="DAY" + str(day + 1), type='filepath') for day in range(10)
]

iface = gr.Interface(fn=main, inputs=inputs, outputs=outputs)

iface.launch()