Spaces:
Running
Running
Update app.py
Browse files
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
|
8 |
-
|
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(
|
|
|
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()
|