Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,68 +1,49 @@
|
|
1 |
import asyncio
|
2 |
import streamlit as st
|
3 |
-
import http.server
|
4 |
-
import socketserver
|
5 |
|
6 |
-
PORT = 8000
|
7 |
-
|
8 |
-
servers = {}
|
9 |
-
inputs = []
|
10 |
-
outputs = []
|
11 |
-
used_ports = []
|
12 |
server_ports = []
|
13 |
client_ports = []
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
st.set_page_config(layout="wide")
|
22 |
|
23 |
async def main():
|
24 |
-
|
25 |
-
st.session_state.update(st.session_state)
|
26 |
-
|
27 |
-
if "server_ports" not in st.session_state:
|
28 |
-
st.session_state['server_ports'] = ""
|
29 |
-
if "client_ports" not in st.session_state:
|
30 |
-
st.session_state['client_ports'] = ""
|
31 |
-
if "user_ID" not in st.session_state:
|
32 |
-
st.session_state.user_ID = ""
|
33 |
-
if "gradio_Port" not in st.session_state:
|
34 |
-
st.session_state.gradio_Port = ""
|
35 |
-
if "servers" not in st.session_state:
|
36 |
-
st.session_state.servers = None
|
37 |
-
if "server" not in st.session_state:
|
38 |
-
st.session_state.server = None
|
39 |
-
if "clients" not in st.session_state:
|
40 |
-
st.session_state.clients = None
|
41 |
-
if "api_key" not in st.session_state:
|
42 |
-
st.session_state.api_key = None
|
43 |
-
if "tokenChar" not in st.session_state:
|
44 |
-
st.session_state.tokenChar = None
|
45 |
-
if "charName" not in st.session_state:
|
46 |
-
st.session_state.charName = None
|
47 |
-
if "character_ID" not in st.session_state:
|
48 |
-
st.session_state.character_ID = None
|
49 |
-
|
50 |
-
if st.session_state.server == None:
|
51 |
-
st.session_state.active_page = 'clients'
|
52 |
-
else: st.session_state.active_page = 'servers'
|
53 |
|
54 |
st.title("NeuralGPT")
|
55 |
|
56 |
-
st.sidebar.text("Gradio app")
|
57 |
gradio_Ports = st.container(border=True)
|
58 |
gradio_Ports.markdown(st.session_state.gradio_Port)
|
59 |
-
serverPorts = st.sidebar.container(border=True)
|
60 |
-
serverPorts.markdown(st.session_state['server_ports'])
|
61 |
-
st.sidebar.text("Client ports")
|
62 |
-
clientPorts = st.sidebar.container(border=True)
|
63 |
-
clientPorts.markdown(st.session_state['client_ports'])
|
64 |
-
st.sidebar.text("Charavter.ai ID")
|
65 |
-
user_id = st.sidebar.container(border=True)
|
66 |
-
user_id.markdown(st.session_state.user_ID)
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
asyncio.run(main())
|
|
|
1 |
import asyncio
|
2 |
import streamlit as st
|
|
|
|
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
server_ports = []
|
5 |
client_ports = []
|
6 |
|
7 |
+
# Inicjalizacja danych w st.session_state
|
8 |
+
if "server_ports" not in st.session_state:
|
9 |
+
st.session_state['server_ports'] = ""
|
10 |
+
if "client_ports" not in st.session_state:
|
11 |
+
st.session_state['client_ports'] = ""
|
12 |
+
if "user_ID" not in st.session_state:
|
13 |
+
st.session_state.user_ID = ""
|
14 |
+
if "gradio_Port" not in st.session_state:
|
15 |
+
st.session_state.gradio_Port = ""
|
16 |
+
if "server" not in st.session_state:
|
17 |
+
st.session_state.server = False
|
18 |
+
if "client" not in st.session_state:
|
19 |
+
st.session_state.client = False
|
20 |
|
21 |
st.set_page_config(layout="wide")
|
22 |
|
23 |
async def main():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
st.title("NeuralGPT")
|
26 |
|
|
|
27 |
gradio_Ports = st.container(border=True)
|
28 |
gradio_Ports.markdown(st.session_state.gradio_Port)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
+
with st.sidebar:
|
31 |
+
# Wyświetlanie danych, które mogą być modyfikowane na różnych stronach
|
32 |
+
serverPorts = st.container(border=True)
|
33 |
+
serverPorts.markdown(st.session_state['server_ports'])
|
34 |
+
st.text("Client ports")
|
35 |
+
clientPorts = st.container(border=True)
|
36 |
+
clientPorts.markdown(st.session_state['client_ports'])
|
37 |
+
st.text("Character.ai ID")
|
38 |
+
user_id = st.container(border=True)
|
39 |
+
user_id.markdown(st.session_state.user_ID)
|
40 |
+
status = st.status(label="runs", state="complete", expanded=False)
|
41 |
+
|
42 |
+
if st.session_state.server == True:
|
43 |
+
st.markdown("server running...")
|
44 |
+
|
45 |
+
if st.session_state.client == True:
|
46 |
+
st.markdown("client running")
|
47 |
+
|
48 |
+
# Uruchomienie aplikacji
|
49 |
asyncio.run(main())
|