Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -104,14 +104,13 @@ Assistant: <utterance>
|
|
104 |
In this app, you can explore the outputs of a gpt-3.5-turbo LLM.
|
105 |
"""
|
106 |
|
107 |
-
with gr.Blocks(
|
108 |
-
#chatbot {height: 520px; overflow: auto;}""") as demo:
|
109 |
gr.HTML(title)
|
110 |
gr.HTML('''<center><a href="https://huggingface.co/spaces/ysharma/ChatGPTwithAPI?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>Duplicate the Space and run securely with your OpenAI API Key</center>''')
|
111 |
with gr.Column(elem_id = "col_container"):
|
112 |
openai_api_key = gr.Textbox(type='password', label="Enter your OpenAI API key here")
|
113 |
chatbot = gr.Chatbot(elem_id = "chatbot") #c
|
114 |
-
inputs = gr.Textbox(placeholder = "Hi there!", label= "Type an input and press Enter") #t
|
115 |
state = gr.State([]) #s
|
116 |
b1 = gr.Button()
|
117 |
|
@@ -119,14 +118,12 @@ with gr.Blocks(css = """#col_container {width: 1000px; margin-left: auto; margin
|
|
119 |
with gr.Accordion("Parameters", open=False):
|
120 |
top_p = gr.Slider( minimum=-0, maximum=1.0, value=1.0, step=0.05, interactive=True, label="Top-p (nucleus sampling)",)
|
121 |
temperature = gr.Slider( minimum=-0, maximum=5.0, value=1.0, step=0.1, interactive=True, label="Temperature",)
|
122 |
-
#top_k = gr.Slider( minimum=1, maximum=50, value=4, step=1, interactive=True, label="Top-k",)
|
123 |
-
#repetition_penalty = gr.Slider( minimum=0.1, maximum=3.0, value=1.03, step=0.01, interactive=True, label="Repetition Penalty", )
|
124 |
chat_counter = gr.Number(value=0, visible=False, precision=0)
|
125 |
|
126 |
-
inputs.submit(
|
127 |
-
b1.click(
|
128 |
b1.click(reset_textbox, [], [inputs])
|
129 |
inputs.submit(reset_textbox, [], [inputs])
|
130 |
|
131 |
-
#gr.Markdown(description)
|
132 |
demo.queue().launch(debug=True)
|
|
|
|
104 |
In this app, you can explore the outputs of a gpt-3.5-turbo LLM.
|
105 |
"""
|
106 |
|
107 |
+
with gr.Blocks() as demo:
|
|
|
108 |
gr.HTML(title)
|
109 |
gr.HTML('''<center><a href="https://huggingface.co/spaces/ysharma/ChatGPTwithAPI?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>Duplicate the Space and run securely with your OpenAI API Key</center>''')
|
110 |
with gr.Column(elem_id = "col_container"):
|
111 |
openai_api_key = gr.Textbox(type='password', label="Enter your OpenAI API key here")
|
112 |
chatbot = gr.Chatbot(elem_id = "chatbot") #c
|
113 |
+
inputs = gr.Textbox(placeholder = "Hi there!", label= "Type an input and press Enter", lines=3) #t
|
114 |
state = gr.State([]) #s
|
115 |
b1 = gr.Button()
|
116 |
|
|
|
118 |
with gr.Accordion("Parameters", open=False):
|
119 |
top_p = gr.Slider( minimum=-0, maximum=1.0, value=1.0, step=0.05, interactive=True, label="Top-p (nucleus sampling)",)
|
120 |
temperature = gr.Slider( minimum=-0, maximum=5.0, value=1.0, step=0.1, interactive=True, label="Temperature",)
|
|
|
|
|
121 |
chat_counter = gr.Number(value=0, visible=False, precision=0)
|
122 |
|
123 |
+
inputs.submit(predict, [inputs, top_p, temperature, openai_api_key, chat_counter, chatbot, state], [chatbot, state, chat_counter],)
|
124 |
+
b1.click(predict, [inputs, top_p, temperature, openai_api_key, chat_counter, chatbot, state], [chatbot, state, chat_counter],)
|
125 |
b1.click(reset_textbox, [], [inputs])
|
126 |
inputs.submit(reset_textbox, [], [inputs])
|
127 |
|
|
|
128 |
demo.queue().launch(debug=True)
|
129 |
+
|