afrizalha commited on
Commit
e332208
1 Parent(s): e4f353c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -18
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
- request = str(request)
14
- results = []
15
- for i in range(iterations):
16
- chat_completion = client.chat.completions.create(
17
- messages=[
18
- {"role": 'system', "content": sysint},
19
- {"role": 'user', "content": request}],
20
- temperature=temp,
21
- top_p=topp,
22
- max_tokens=700,
23
- model=model
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(