Spaces:
Running
Running
Space-Face
commited on
Commit
•
271c54a
1
Parent(s):
4ce9873
Update main.py
Browse files
main.py
CHANGED
@@ -1,6 +1,12 @@
|
|
1 |
import SpaceFace as sf
|
2 |
-
|
|
|
3 |
def receivedMessage(self, message, user: sf.User, responder: sf.Responder):
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
5 |
responder.close()
|
6 |
-
sf.start_server([
|
|
|
1 |
import SpaceFace as sf
|
2 |
+
import GPTSimple as ai
|
3 |
+
class AIEndpoint:
|
4 |
def receivedMessage(self, message, user: sf.User, responder: sf.Responder):
|
5 |
+
if hasattr(user, 'chat'):
|
6 |
+
|
7 |
+
responder.respond(user.chat.ask(message))
|
8 |
+
else:
|
9 |
+
chat = ai.conversation(base_url="deepinfra", model="meta-llama/Llama-3.2-90B-Vision-Instruct")
|
10 |
+
responder.respond(user.chat.ask(message))
|
11 |
responder.close()
|
12 |
+
sf.start_server([AIEndpoint()])
|