Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -13,6 +13,37 @@ from huggingface_hub import InferenceClient, login
|
|
13 |
import time
|
14 |
import os
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
lock_file_path = "test.txt"
|
17 |
|
18 |
if not os.path.exists(lock_file_path):
|
@@ -22,6 +53,9 @@ if not os.path.exists(lock_file_path):
|
|
22 |
else:
|
23 |
print("Streamlit app is already running, only streaming activity.")
|
24 |
clone = True
|
|
|
|
|
|
|
25 |
|
26 |
try:
|
27 |
os.mkdir("data")
|
@@ -52,38 +86,6 @@ client = discord.Client(intents=intents)
|
|
52 |
launch_time = datetime.datetime.utcnow()
|
53 |
|
54 |
|
55 |
-
|
56 |
-
ph = st.empty()
|
57 |
-
|
58 |
-
async def syncMessages():
|
59 |
-
print(os.listdir(f"data"))
|
60 |
-
if os.listdir("data") == []:
|
61 |
-
return 0
|
62 |
-
ph.empty()
|
63 |
-
with ph.container():
|
64 |
-
dirs = st.tabs(os.listdir("data"))
|
65 |
-
i = -1
|
66 |
-
for dir in os.listdir("data"):
|
67 |
-
i += 1
|
68 |
-
with dirs[i]:
|
69 |
-
print(i, os.listdir(f"data/{dir}"))
|
70 |
-
if os.listdir(f"data/{dir}") == []:
|
71 |
-
return 0
|
72 |
-
files = st.tabs(os.listdir("data/" + dir))
|
73 |
-
k = -1
|
74 |
-
for file in os.listdir("data/" + dir):
|
75 |
-
k += 1
|
76 |
-
with files[k]:
|
77 |
-
with open(f"data/{dir}/{file}", "r") as f:
|
78 |
-
o = f.read().split("<|end_of_turn|>")
|
79 |
-
print(o)
|
80 |
-
for item in o:
|
81 |
-
if item == "":
|
82 |
-
continue
|
83 |
-
item = item.split(": ", 1)
|
84 |
-
st.markdown(f":blue[{item[0].split('GPT4 Correct ')[1]}]: {item[1]}")
|
85 |
-
|
86 |
-
|
87 |
@client.event
|
88 |
async def on_ready():
|
89 |
if clone:
|
|
|
13 |
import time
|
14 |
import os
|
15 |
|
16 |
+
|
17 |
+
ph = st.empty()
|
18 |
+
|
19 |
+
async def syncMessages():
|
20 |
+
print(os.listdir(f"data"))
|
21 |
+
if os.listdir("data") == []:
|
22 |
+
return 0
|
23 |
+
ph.empty()
|
24 |
+
with ph.container():
|
25 |
+
dirs = st.tabs(os.listdir("data"))
|
26 |
+
i = -1
|
27 |
+
for dir in os.listdir("data"):
|
28 |
+
i += 1
|
29 |
+
with dirs[i]:
|
30 |
+
print(i, os.listdir(f"data/{dir}"))
|
31 |
+
if os.listdir(f"data/{dir}") == []:
|
32 |
+
return 0
|
33 |
+
files = st.tabs(os.listdir("data/" + dir))
|
34 |
+
k = -1
|
35 |
+
for file in os.listdir("data/" + dir):
|
36 |
+
k += 1
|
37 |
+
with files[k]:
|
38 |
+
with open(f"data/{dir}/{file}", "r") as f:
|
39 |
+
o = f.read().split("<|end_of_turn|>")
|
40 |
+
print(o)
|
41 |
+
for item in o:
|
42 |
+
if item == "":
|
43 |
+
continue
|
44 |
+
item = item.split(": ", 1)
|
45 |
+
st.markdown(f":blue[{item[0].split('GPT4 Correct ')[1]}]: {item[1]}")
|
46 |
+
|
47 |
lock_file_path = "test.txt"
|
48 |
|
49 |
if not os.path.exists(lock_file_path):
|
|
|
53 |
else:
|
54 |
print("Streamlit app is already running, only streaming activity.")
|
55 |
clone = True
|
56 |
+
while True:
|
57 |
+
asyncio.run(syncMessages())
|
58 |
+
time.sleep(0.5)
|
59 |
|
60 |
try:
|
61 |
os.mkdir("data")
|
|
|
86 |
launch_time = datetime.datetime.utcnow()
|
87 |
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
@client.event
|
90 |
async def on_ready():
|
91 |
if clone:
|