Araeynn commited on
Commit
fc59755
1 Parent(s): 35e2a53

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -51
app.py CHANGED
@@ -32,15 +32,6 @@ IC = AsyncInferenceClient(model="salesforce/blip-image-captioning-large")
32
  PRK = AsyncInferenceClient(model="nvidia/parakeet-tdt-1.1b")
33
  MG = AsyncInferenceClient(model="facebook/musicgen-stereo-small")
34
 
35
- # INIT
36
- ph = st.empty()
37
- try:
38
- os.mkdir("data")
39
- os.mkdir("usrtime")
40
- except:
41
- pass
42
- st.link_button(label="Invite the Bot", url="https://discord.com/api/oauth2/authorize?client_id=1116821362695221349&permissions=1067299753024&scope=bot", type="secondary")
43
-
44
  # OPTIONS
45
  eot = " [/INST] "
46
  sot = " [INST] "
@@ -49,53 +40,11 @@ bannedUsers = json.loads(info)["bannedUsers"]
49
  imageModel = json.loads(info)["imageModel"]
50
  userTimes = json.loads(info)["userTimes"]
51
 
52
- # functions
53
- def syncMessages():
54
- with ph.container():
55
- st.link_button(label="Invite the Bot", url="https://discord.com/api/oauth2/authorize?client_id=1116821362695221349&permissions=1067299753024&scope=bot", type="primary")
56
- st.markdown(f"`Status:` :green[**Running**]")
57
- if os.listdir("data") == []:
58
- return 0
59
- dirs = st.tabs(os.listdir("data"))
60
- i = -1
61
- for dir in os.listdir("data"):
62
- i += 1
63
- with dirs[i]:
64
- if os.listdir(f"data/{dir}") == []:
65
- return 0
66
- files = st.tabs(os.listdir("data/" + dir))
67
- k = -1
68
- for file in os.listdir("data/" + dir):
69
- k += 1
70
- with files[k]:
71
- with open(f"data/{dir}/{file}", "r") as f:
72
- o = f.read().split("<|end_of_turn|>")
73
- for item in o:
74
- if item == "":
75
- continue
76
- item = item.split(": ", 1)
77
- st.markdown(f":blue[{item[0].split('GPT4 Correct ')[1]}]: {item[1]}")
78
-
79
  def ec(x, fd="<|image|>", sd="<|image|>"):
80
  matches = re.findall(re.escape(fd) + "(.*?)" + re.escape(sd), x)
81
  matches = matches if matches else [""]
82
  return matches
83
 
84
- # Clone Check
85
- lfp = "test.txt"
86
- if not os.path.exists(lfp):
87
- with open(lfp, "w") as f:
88
- f.write("ew")
89
- clone = False
90
- st.markdown("Bot is running, reload the page to see activity.")
91
- else:
92
- print("Streamlit app is already running, only streaming activity.")
93
- clone = True
94
- while True:
95
- syncMessages()
96
- time.sleep(0.5)
97
- exit()
98
-
99
  bot = discord.Bot()
100
 
101
  @bot.event
 
32
  PRK = AsyncInferenceClient(model="nvidia/parakeet-tdt-1.1b")
33
  MG = AsyncInferenceClient(model="facebook/musicgen-stereo-small")
34
 
 
 
 
 
 
 
 
 
 
35
  # OPTIONS
36
  eot = " [/INST] "
37
  sot = " [INST] "
 
40
  imageModel = json.loads(info)["imageModel"]
41
  userTimes = json.loads(info)["userTimes"]
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  def ec(x, fd="<|image|>", sd="<|image|>"):
44
  matches = re.findall(re.escape(fd) + "(.*?)" + re.escape(sd), x)
45
  matches = matches if matches else [""]
46
  return matches
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  bot = discord.Bot()
49
 
50
  @bot.event