Commit
·
17d0c40
1
Parent(s):
c74429f
Update app.py
Browse files
app.py
CHANGED
@@ -31,6 +31,7 @@ class ChatWrapper:
|
|
31 |
):
|
32 |
"""Execute the chat functionality."""
|
33 |
self.lock.acquire()
|
|
|
34 |
try:
|
35 |
history = history or []
|
36 |
# If chain is None, that is because no API key was provided.
|
@@ -50,7 +51,7 @@ class ChatWrapper:
|
|
50 |
return history, history
|
51 |
|
52 |
chat = ChatWrapper()
|
53 |
-
state = gr.State(
|
54 |
|
55 |
def echo(name, request: gr.Request):
|
56 |
if request:
|
@@ -62,7 +63,7 @@ def echo(name, request: gr.Request):
|
|
62 |
def my_inference_function(name):
|
63 |
return "Hello " + name + "!"
|
64 |
|
65 |
-
gradio_interface = gr.Interface(chat, inputs=['text',state], outputs=[
|
66 |
gradio_interface.launch()
|
67 |
|
68 |
|
|
|
31 |
):
|
32 |
"""Execute the chat functionality."""
|
33 |
self.lock.acquire()
|
34 |
+
chain = set_openai_api_key('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')
|
35 |
try:
|
36 |
history = history or []
|
37 |
# If chain is None, that is because no API key was provided.
|
|
|
51 |
return history, history
|
52 |
|
53 |
chat = ChatWrapper()
|
54 |
+
state = gr.State()
|
55 |
|
56 |
def echo(name, request: gr.Request):
|
57 |
if request:
|
|
|
63 |
def my_inference_function(name):
|
64 |
return "Hello " + name + "!"
|
65 |
|
66 |
+
gradio_interface = gr.Interface(chat, inputs=['text',state], outputs=['text', state])
|
67 |
gradio_interface.launch()
|
68 |
|
69 |
|