Delete app.py
Browse files
app.py
DELETED
@@ -1,68 +0,0 @@
|
|
1 |
-
# A3C++ a modified version of Asynchronous Advantage actor critic algorithm
|
2 |
-
# -----------------------------------
|
3 |
-
#
|
4 |
-
# A3C paper: https://arxiv.org/abs/1602.01783
|
5 |
-
#
|
6 |
-
# The A3C implementation is available at:
|
7 |
-
# https://jaromiru.com/2017/02/16/lets-make-an-a3c-theory/
|
8 |
-
# by: Jaromir Janisch, 2017
|
9 |
-
|
10 |
-
# Two variations are implemented: A memory replay and a deterministic search following argmax(pi) instead of pi as a probability distribution
|
11 |
-
# Every action selection is made following the action with the highest probability pi
|
12 |
-
|
13 |
-
# Author: Taha Nakabi
|
14 |
-
|
15 |
-
# Args: 'train' for training the model anything else will skip the training and try to use already saved models
|
16 |
-
|
17 |
-
# import tensorflow as tf
|
18 |
-
# import numpy as np
|
19 |
-
# import gym, time, random, threading
|
20 |
-
# from keras.callbacks import TensorBoard
|
21 |
-
# from keras.models import *
|
22 |
-
# from keras.layers import *
|
23 |
-
# from keras import backend as K
|
24 |
-
|
25 |
-
# from tcl_env_dqn_1 import *
|
26 |
-
|
27 |
-
# import os
|
28 |
-
import gradio as gr
|
29 |
-
from gradio.components import *
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
def main(use_default, file):
|
34 |
-
# if __name__ == '__main__':
|
35 |
-
|
36 |
-
|
37 |
-
# subprocess.run(['python', './A3C_plusplus.py'])
|
38 |
-
|
39 |
-
|
40 |
-
base = r'./RESULT/'
|
41 |
-
img_path = []
|
42 |
-
for i in range(1, 11):
|
43 |
-
temp_path = base + 'Day' + str(i) + '.png'
|
44 |
-
img_path.append(temp_path)
|
45 |
-
# else:
|
46 |
-
# 根据上传的文件执行相应的逻辑
|
47 |
-
# 请根据您的实际需求自行编写代码
|
48 |
-
|
49 |
-
return [img for img in img_path]
|
50 |
-
|
51 |
-
# 创建一个复选框来表示是否选择默认文件
|
52 |
-
default_checkbox = gr.inputs.Checkbox(label="使用默认文件", default=False)
|
53 |
-
|
54 |
-
inputs = [
|
55 |
-
default_checkbox,
|
56 |
-
File(label="上传文件", optional=True)
|
57 |
-
]
|
58 |
-
outputs = [
|
59 |
-
Image(label="DAY" + str(day + 1), type='filepath') for
|
60 |
-
day in range(10)
|
61 |
-
]
|
62 |
-
|
63 |
-
iface = gr.Interface(fn=main, inputs=inputs, outputs=outputs)
|
64 |
-
|
65 |
-
iface.launch()
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|