Update app.py
Browse files
app.py
CHANGED
@@ -10,24 +10,17 @@ client = OpenAI(api_key=api_secret)
|
|
10 |
sysint ='Sampean asisten ingkang mangsuli ngangge basa Jawa Krama, sanes Ngoko.'
|
11 |
|
12 |
def ask(request, temp, topp,):
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
)
|
25 |
-
rescount = f'Result {i+1}:\n'
|
26 |
-
respond = chat_completion.choices[0].message.content
|
27 |
-
nline = '\n_______________________________________\n'
|
28 |
-
results.append(f'{rescount}{respond}{nline}')
|
29 |
-
|
30 |
-
return ''.join(results)
|
31 |
|
32 |
with gr.Blocks(theme='snehilsanyal/scikit-learn') as app:
|
33 |
gr.Interface(
|
|
|
10 |
sysint ='Sampean asisten ingkang mangsuli ngangge basa Jawa Krama, sanes Ngoko.'
|
11 |
|
12 |
def ask(request, temp, topp,):
|
13 |
+
chat_completion = client.chat.completions.create(
|
14 |
+
messages=[
|
15 |
+
{"role": 'system', "content": sysint},
|
16 |
+
{"role": 'user', "content": request}],
|
17 |
+
temperature=temp,
|
18 |
+
top_p=topp,
|
19 |
+
max_tokens=700,
|
20 |
+
model=model
|
21 |
+
)
|
22 |
+
response = chat_completion.choices[0].message.content
|
23 |
+
return response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
with gr.Blocks(theme='snehilsanyal/scikit-learn') as app:
|
26 |
gr.Interface(
|