Tonic commited on
Commit
a363a17
Β·
1 Parent(s): a2d6132

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -16,12 +16,13 @@ def ask_openai(question):
16
  role="user",
17
  content=question,
18
  assistant_id=assistant_id
19
-
20
  )
 
21
  run = client.beta.threads.runs.create(
22
  thread_id=thread.id,
23
  assistant_id=assistant_id
24
  )
 
25
  run = client.beta.threads.runs.retrieve(
26
  thread_id=thread.id,
27
  run_id=run.id,
@@ -29,9 +30,8 @@ def ask_openai(question):
29
  )
30
 
31
  messages = client.beta.threads.messages.list(
32
- thread_id=thread.id
33
  assistant_id=assistant_id
34
-
35
  )
36
  response = next((msg for msg in messages['data'] if msg['role'] == 'assistant'), None)
37
  return response['content'][0]['text']['value'] if response else "No response."
@@ -43,7 +43,6 @@ examples = [
43
  ]
44
 
45
  iface = gr.Interface(
46
- # theme="ParityError/Anime",
47
  fn=ask_openai,
48
  inputs=gr.Textbox(lines=5, placeholder="Hi there, I have a plant that's..."),
49
  outputs=gr.Markdown(),
@@ -52,4 +51,4 @@ iface = gr.Interface(
52
  examples=examples
53
  )
54
 
55
- iface.launch()
 
16
  role="user",
17
  content=question,
18
  assistant_id=assistant_id
 
19
  )
20
+
21
  run = client.beta.threads.runs.create(
22
  thread_id=thread.id,
23
  assistant_id=assistant_id
24
  )
25
+
26
  run = client.beta.threads.runs.retrieve(
27
  thread_id=thread.id,
28
  run_id=run.id,
 
30
  )
31
 
32
  messages = client.beta.threads.messages.list(
33
+ thread_id=thread.id,
34
  assistant_id=assistant_id
 
35
  )
36
  response = next((msg for msg in messages['data'] if msg['role'] == 'assistant'), None)
37
  return response['content'][0]['text']['value'] if response else "No response."
 
43
  ]
44
 
45
  iface = gr.Interface(
 
46
  fn=ask_openai,
47
  inputs=gr.Textbox(lines=5, placeholder="Hi there, I have a plant that's..."),
48
  outputs=gr.Markdown(),
 
51
  examples=examples
52
  )
53
 
54
+ iface.launch(theme="Tonic/greenblast")