Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,15 +8,29 @@ from groq import Groq
|
|
8 |
|
9 |
client = Groq(api_key=os.getenv('GROQ_API_KEY'))
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
if text != "":
|
|
|
|
|
|
|
|
|
|
|
13 |
response = client.chat.completions.create(
|
14 |
model='gemma-7b-it',
|
15 |
messages=[
|
16 |
{
|
17 |
"role": "user",
|
18 |
"content": text
|
19 |
-
}
|
|
|
20 |
stream=True
|
21 |
)
|
22 |
|
|
|
8 |
|
9 |
client = Groq(api_key=os.getenv('GROQ_API_KEY'))
|
10 |
|
11 |
+
SYSTEM_PROMPT = """
|
12 |
+
You complete the sentence in a funny way. Use emojis wherever possible
|
13 |
+
"""
|
14 |
+
|
15 |
+
spaceIndex = 0
|
16 |
+
|
17 |
+
def autocomplete(text):
|
18 |
+
global spaceIndex
|
19 |
+
textLength = len(text)
|
20 |
if text != "":
|
21 |
+
if text[-1] == " " and spaceIndex < (textLength - 1):
|
22 |
+
spaceIndex = textLength - 1
|
23 |
+
else:
|
24 |
+
return
|
25 |
+
|
26 |
response = client.chat.completions.create(
|
27 |
model='gemma-7b-it',
|
28 |
messages=[
|
29 |
{
|
30 |
"role": "user",
|
31 |
"content": text
|
32 |
+
}
|
33 |
+
],
|
34 |
stream=True
|
35 |
)
|
36 |
|