Spaces:
Runtime error
Runtime error
Commit
·
6e9e23f
1
Parent(s):
c1336c1
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
import time
|
2 |
import logging
|
3 |
import gradio as gr
|
4 |
-
import os
|
5 |
-
os.environ.getattribute("OPENAI_API_KEY")
|
6 |
|
7 |
from src.llm_boilers import llm_boiler
|
8 |
|
@@ -112,11 +110,30 @@ def call_inf_server(prompt, openai_key):
|
|
112 |
logging.warning(f"Result of text generation: {response}")
|
113 |
return response
|
114 |
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
msg = gr.Textbox(
|
121 |
label="Chat Message Box",
|
122 |
placeholder="Chat Message Box",
|
|
|
1 |
import time
|
2 |
import logging
|
3 |
import gradio as gr
|
|
|
|
|
4 |
|
5 |
from src.llm_boilers import llm_boiler
|
6 |
|
|
|
110 |
logging.warning(f"Result of text generation: {response}")
|
111 |
return response
|
112 |
|
113 |
+
|
114 |
+
with gr.Blocks(
|
115 |
+
theme=gr.themes.Soft(),
|
116 |
+
css=".disclaimer {font-variant-caps: all-small-caps;}",
|
117 |
+
) as demo:
|
118 |
+
gr.Markdown(
|
119 |
+
"""<h1><center>Chat with gpt-3.5-turbo</center></h1>
|
120 |
+
This is a lightweight demo of gpt-3.5-turbo conversation completion. It was designed as a template for in-context learning applications to be built on top of.
|
121 |
+
"""
|
122 |
+
)
|
123 |
+
conversation = Chat()
|
124 |
+
with gr.Row():
|
125 |
+
with gr.Column():
|
126 |
+
# to do: change to openaikey input for public release
|
127 |
+
openai_key = gr.Textbox(
|
128 |
+
label="OpenAI Key",
|
129 |
+
value="",
|
130 |
+
type="password",
|
131 |
+
placeholder="sk..",
|
132 |
+
info="You have to provide your own OpenAI API key.",
|
133 |
+
)
|
134 |
+
chatbot = gr.Chatbot().style(height=400)
|
135 |
+
with gr.Row():
|
136 |
+
with gr.Column():
|
137 |
msg = gr.Textbox(
|
138 |
label="Chat Message Box",
|
139 |
placeholder="Chat Message Box",
|