localFileToRemote
Browse files- functional_crazy.py +5 -1
- main.py +11 -2
functional_crazy.py
CHANGED
@@ -33,4 +33,8 @@ def get_crazy_functionals():
|
|
33 |
},
|
34 |
}
|
35 |
|
36 |
-
|
|
|
|
|
|
|
|
|
|
33 |
},
|
34 |
}
|
35 |
|
36 |
+
def on_file_uploaded(file):
|
37 |
+
with open(file[0].name,'r') as f:
|
38 |
+
print(f.read())
|
39 |
+
print('uploaded')
|
40 |
+
pass
|
main.py
CHANGED
@@ -25,7 +25,7 @@ from functional import get_functionals
|
|
25 |
functional = get_functionals()
|
26 |
|
27 |
# 对一些丧心病狂的实验性功能模块进行测试
|
28 |
-
from functional_crazy import get_crazy_functionals
|
29 |
crazy_functional = get_crazy_functionals()
|
30 |
|
31 |
# 处理markdown文本格式的转变
|
@@ -58,9 +58,17 @@ with gr.Blocks(theme=set_theme, analytics_enabled=False) as demo:
|
|
58 |
for k in functional:
|
59 |
variant = functional[k]["Color"] if "Color" in functional[k] else "secondary"
|
60 |
functional[k]["Button"] = gr.Button(k, variant=variant)
|
|
|
|
|
|
|
61 |
for k in crazy_functional:
|
62 |
variant = crazy_functional[k]["Color"] if "Color" in crazy_functional[k] else "secondary"
|
63 |
crazy_functional[k]["Button"] = gr.Button(k, variant=variant)
|
|
|
|
|
|
|
|
|
|
|
64 |
from check_proxy import check_proxy
|
65 |
statusDisplay = gr.Markdown(f"{check_proxy(proxies)}")
|
66 |
systemPromptTxt = gr.Textbox(show_label=True, placeholder=f"System Prompt", label="System prompt", value=initial_prompt).style(container=True)
|
@@ -77,7 +85,8 @@ with gr.Blocks(theme=set_theme, analytics_enabled=False) as demo:
|
|
77 |
for k in crazy_functional:
|
78 |
crazy_functional[k]["Button"].click(crazy_functional[k]["Function"],
|
79 |
[txt, top_p, temperature, chatbot, history, systemPromptTxt, gr.State(PORT)], [chatbot, history, statusDisplay])
|
80 |
-
|
|
|
81 |
# 延迟函数,做一些准备工作,最后尝试打开浏览器
|
82 |
def auto_opentab_delay():
|
83 |
import threading, webbrowser, time
|
|
|
25 |
functional = get_functionals()
|
26 |
|
27 |
# 对一些丧心病狂的实验性功能模块进行测试
|
28 |
+
from functional_crazy import get_crazy_functionals, on_file_uploaded
|
29 |
crazy_functional = get_crazy_functionals()
|
30 |
|
31 |
# 处理markdown文本格式的转变
|
|
|
58 |
for k in functional:
|
59 |
variant = functional[k]["Color"] if "Color" in functional[k] else "secondary"
|
60 |
functional[k]["Button"] = gr.Button(k, variant=variant)
|
61 |
+
with gr.Row():
|
62 |
+
gr.Markdown("Input Directory Functions.")
|
63 |
+
with gr.Row():
|
64 |
for k in crazy_functional:
|
65 |
variant = crazy_functional[k]["Color"] if "Color" in crazy_functional[k] else "secondary"
|
66 |
crazy_functional[k]["Button"] = gr.Button(k, variant=variant)
|
67 |
+
with gr.Row():
|
68 |
+
gr.Markdown("Upload Files Functions.")
|
69 |
+
with gr.Row():
|
70 |
+
file_upload = gr.Files(file_count="multiple")
|
71 |
+
|
72 |
from check_proxy import check_proxy
|
73 |
statusDisplay = gr.Markdown(f"{check_proxy(proxies)}")
|
74 |
systemPromptTxt = gr.Textbox(show_label=True, placeholder=f"System Prompt", label="System prompt", value=initial_prompt).style(container=True)
|
|
|
85 |
for k in crazy_functional:
|
86 |
crazy_functional[k]["Button"].click(crazy_functional[k]["Function"],
|
87 |
[txt, top_p, temperature, chatbot, history, systemPromptTxt, gr.State(PORT)], [chatbot, history, statusDisplay])
|
88 |
+
file_upload.upload(on_file_uploaded, [file_upload])
|
89 |
+
|
90 |
# 延迟函数,做一些准备工作,最后尝试打开浏览器
|
91 |
def auto_opentab_delay():
|
92 |
import threading, webbrowser, time
|