update app.py file
Browse files
app.py
CHANGED
|
@@ -92,33 +92,28 @@ def predict(inputs, top_p, temperature, openai_api_key, chat_counter, chatbot=[]
|
|
| 92 |
def reset_textbox():
|
| 93 |
return gr.update(value='')
|
| 94 |
|
| 95 |
-
title = """<h1 align="center">
|
| 96 |
-
description = """Language models can be conditioned to act like dialogue agents through a conversational prompt
|
| 97 |
-
```
|
| 98 |
-
User: <utterance>
|
| 99 |
-
Assistant: <utterance>
|
| 100 |
-
User: <utterance>
|
| 101 |
-
Assistant: <utterance>
|
| 102 |
-
...
|
| 103 |
-
```
|
| 104 |
-
In this app, you can explore the outputs of a gpt-3.5-turbo LLM.
|
| 105 |
"""
|
| 106 |
|
| 107 |
with gr.Blocks(css = """#col_container {width: 1000px; margin-left: auto; margin-right: auto;}
|
| 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= "
|
| 115 |
state = gr.State([]) #s
|
| 116 |
b1 = gr.Button()
|
| 117 |
|
| 118 |
#inputs, top_p, temperature, top_k, repetition_penalty
|
| 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=
|
| 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)
|
|
@@ -129,4 +124,7 @@ with gr.Blocks(css = """#col_container {width: 1000px; margin-left: auto; margin
|
|
| 129 |
inputs.submit(reset_textbox, [], [inputs])
|
| 130 |
|
| 131 |
#gr.Markdown(description)
|
| 132 |
-
demo.queue().launch(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
def reset_textbox():
|
| 93 |
return gr.update(value='')
|
| 94 |
|
| 95 |
+
title = """<h1 align="center">PromptAI</h1>"""
|
| 96 |
+
description = """<h2 align="center">Engage your chat with a bot that can respond intelligently, answer questions, ask trivia. Anything you can come up with! Create custom commands with no programming knowledge, all from a web interface.Language models can be conditioned to act like dialogue agents through a conversational prompt.In this app, you can explore the outputs of a gpt-3.5-turbo LLM.</h2>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
"""
|
| 98 |
|
| 99 |
with gr.Blocks(css = """#col_container {width: 1000px; margin-left: auto; margin-right: auto;}
|
| 100 |
#chatbot {height: 520px; overflow: auto;}""") as demo:
|
| 101 |
gr.HTML(title)
|
| 102 |
+
gr.HTML(description)
|
| 103 |
+
|
| 104 |
+
|
| 105 |
# 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>''')
|
| 106 |
with gr.Column(elem_id = "col_container"):
|
| 107 |
openai_api_key = gr.Textbox(type='password', label="Enter your OpenAI API key here")
|
| 108 |
chatbot = gr.Chatbot(elem_id='chatbot') #c
|
| 109 |
+
inputs = gr.Textbox(placeholder= "Hi there!", label= "Write a prompt and press Enter") #t
|
| 110 |
state = gr.State([]) #s
|
| 111 |
b1 = gr.Button()
|
| 112 |
|
| 113 |
#inputs, top_p, temperature, top_k, repetition_penalty
|
| 114 |
with gr.Accordion("Parameters", open=False):
|
| 115 |
top_p = gr.Slider( minimum=-0, maximum=1.0, value=1.0, step=0.05, interactive=True, label="Top-p (nucleus sampling)",)
|
| 116 |
+
temperature = gr.Slider( minimum=-0, maximum=7.0, value=1.0, step=0.1, interactive=True, label="Temperature",)
|
| 117 |
#top_k = gr.Slider( minimum=1, maximum=50, value=4, step=1, interactive=True, label="Top-k",)
|
| 118 |
#repetition_penalty = gr.Slider( minimum=0.1, maximum=3.0, value=1.03, step=0.01, interactive=True, label="Repetition Penalty", )
|
| 119 |
chat_counter = gr.Number(value=0, visible=False, precision=0)
|
|
|
|
| 124 |
inputs.submit(reset_textbox, [], [inputs])
|
| 125 |
|
| 126 |
#gr.Markdown(description)
|
| 127 |
+
demo.queue().launch(debug=True)
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
|