Spaces:
Runtime error
Runtime error
seawolf2357
commited on
Commit
โข
a2aef79
1
Parent(s):
a0d56d8
Update app.py
Browse files
app.py
CHANGED
@@ -22,9 +22,7 @@ intents.messages = True
|
|
22 |
intents.guilds = True
|
23 |
intents.guild_messages = True
|
24 |
|
25 |
-
|
26 |
# ์ถ๋ก API ํด๋ผ์ด์ธํธ ์ค์
|
27 |
-
# hf_client = InferenceClient("CohereForAI/c4ai-command-r-plus", token=os.getenv("HF_TOKEN"))
|
28 |
hf_client = InferenceClient("CohereForAI/aya-23-35B", token=os.getenv("HF_TOKEN"))
|
29 |
|
30 |
# PaliGemma ๋ชจ๋ธ ์ค์ (CPU ๋ชจ๋)
|
@@ -146,7 +144,7 @@ def run_gradio():
|
|
146 |
)
|
147 |
|
148 |
# ํน์ ์ฑ๋ ID ์ค์
|
149 |
-
SPECIFIC_CHANNEL_ID = int(os.getenv("DISCORD_CHANNEL_ID", "123456789012345678"))
|
150 |
|
151 |
# ๋์ค์ฝ๋ ๋ด ์ค์
|
152 |
class MyClient(discord.Client):
|
@@ -173,7 +171,6 @@ class MyClient(discord.Client):
|
|
173 |
response = await process_image(image_url, message)
|
174 |
await message.channel.send(response)
|
175 |
else:
|
176 |
-
# ์ฌ์ฉ์ ๋ฉ์์ง๋ฅผ ์ฒ๋ฆฌํ์ฌ Cohere ๋ชจ๋ธ๊ณผ ์ํธ์์ฉ
|
177 |
response = await interact_with_model(message.content)
|
178 |
await message.channel.send(response)
|
179 |
finally:
|
@@ -193,10 +190,9 @@ async def process_image(image_url, message):
|
|
193 |
|
194 |
async def download_image(url):
|
195 |
response = requests.get(url)
|
196 |
-
image = Image.open(io.BytesIO(response.content)).convert("RGB")
|
197 |
return image
|
198 |
|
199 |
if __name__ == "__main__":
|
200 |
discord_client = MyClient(intents=intents)
|
201 |
discord_client.run(os.getenv('DISCORD_TOKEN'))
|
202 |
-
|
|
|
22 |
intents.guilds = True
|
23 |
intents.guild_messages = True
|
24 |
|
|
|
25 |
# ์ถ๋ก API ํด๋ผ์ด์ธํธ ์ค์
|
|
|
26 |
hf_client = InferenceClient("CohereForAI/aya-23-35B", token=os.getenv("HF_TOKEN"))
|
27 |
|
28 |
# PaliGemma ๋ชจ๋ธ ์ค์ (CPU ๋ชจ๋)
|
|
|
144 |
)
|
145 |
|
146 |
# ํน์ ์ฑ๋ ID ์ค์
|
147 |
+
SPECIFIC_CHANNEL_ID = int(os.getenv("DISCORD_CHANNEL_ID", "123456789012345678"))
|
148 |
|
149 |
# ๋์ค์ฝ๋ ๋ด ์ค์
|
150 |
class MyClient(discord.Client):
|
|
|
171 |
response = await process_image(image_url, message)
|
172 |
await message.channel.send(response)
|
173 |
else:
|
|
|
174 |
response = await interact_with_model(message.content)
|
175 |
await message.channel.send(response)
|
176 |
finally:
|
|
|
190 |
|
191 |
async def download_image(url):
|
192 |
response = requests.get(url)
|
193 |
+
image = Image.open(io.BytesIO(response.content)).convert("RGB")
|
194 |
return image
|
195 |
|
196 |
if __name__ == "__main__":
|
197 |
discord_client = MyClient(intents=intents)
|
198 |
discord_client.run(os.getenv('DISCORD_TOKEN'))
|
|