bstraehle commited on
Commit
cb5856a
1 Parent(s): 734c331

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -13
app.py CHANGED
@@ -1,18 +1,9 @@
1
  import gradio as gr
2
- import openai, os
3
 
4
  client = openai.OpenAI(api_key = os.getenv("OPENAI_API_KEY"))
5
- threads = {}
6
 
7
- def predict(message, history, request: gr.Request):
8
- if request.session_hash in threads:
9
- thread = threads[request.session_hash]
10
- else:
11
- threads[request.session_hash] = client.beta.threads.create()
12
-
13
- message = client.beta.threads.messages.create(
14
- thread_id=thread.id,
15
- role="user",
16
- content=message)
17
 
18
- gr.ChatInterface(predict).launch()
 
1
  import gradio as gr
2
+ import openai, os, random
3
 
4
  client = openai.OpenAI(api_key = os.getenv("OPENAI_API_KEY"))
 
5
 
6
+ def random_response(message, history):
7
+ return random.choice(["Yes", "No"])
 
 
 
 
 
 
 
 
8
 
9
+ gr.ChatInterface(random_response).launch()