Spaces:
Sleeping
Sleeping
abdullahmeda
commited on
Commit
•
e03438d
1
Parent(s):
771ac2b
minor fixes
Browse files
app.py
CHANGED
@@ -51,6 +51,15 @@ def init_buffer_memory():
|
|
51 |
return memory
|
52 |
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
with gr.Blocks(css="""
|
55 |
#component-0 { max-width: 900px; margin: auto; padding-top: 1.5rem; }
|
56 |
#duplicate-button { margin: auto; color: white; background: #1565c0; border-radius: 100vh; }
|
@@ -59,9 +68,9 @@ with gr.Blocks(css="""
|
|
59 |
"""
|
60 |
![](https://huggingface.co/spaces/abdullahmeda/OpenChat/resolve/main/banner.png)
|
61 |
|
62 |
-
This Huggingface Gradio Space provides you access to all OpenAI API model that are readily available to
|
63 |
-
|
64 |
-
|
65 |
"""
|
66 |
)
|
67 |
gr.DuplicateButton(value="Duplicate Space for private use", elem_id="duplicate-button")
|
@@ -108,9 +117,9 @@ with gr.Blocks(css="""
|
|
108 |
max_new_tokens = gr.Slider(
|
109 |
label='Max new tokens',
|
110 |
minimum=1,
|
111 |
-
maximum=
|
112 |
step=1,
|
113 |
-
value=
|
114 |
)
|
115 |
temperature = gr.Slider(
|
116 |
label='Temperature',
|
@@ -132,6 +141,7 @@ with gr.Blocks(css="""
|
|
132 |
query.submit(respond, [openai_key, model, temperature, max_new_tokens, query, memory, chatbot], [query, memory, chatbot])
|
133 |
submit.click(respond, [openai_key, model, temperature, max_new_tokens, query, memory, chatbot], [query, memory, chatbot])
|
134 |
|
135 |
-
regenerate.click()
|
|
|
136 |
|
137 |
demo.queue().launch()
|
|
|
51 |
return memory
|
52 |
|
53 |
|
54 |
+
def clear():
|
55 |
+
return init_buffer_memory(), []
|
56 |
+
|
57 |
+
|
58 |
+
def regenerate_response():
|
59 |
+
# TODO: Add functionality
|
60 |
+
pass
|
61 |
+
|
62 |
+
|
63 |
with gr.Blocks(css="""
|
64 |
#component-0 { max-width: 900px; margin: auto; padding-top: 1.5rem; }
|
65 |
#duplicate-button { margin: auto; color: white; background: #1565c0; border-radius: 100vh; }
|
|
|
68 |
"""
|
69 |
![](https://huggingface.co/spaces/abdullahmeda/OpenChat/resolve/main/banner.png)
|
70 |
|
71 |
+
This Huggingface Gradio Space provides you access to all OpenAI API model that are readily available to
|
72 |
+
the public with custom System Messages. Please note that you would be needing an OPENAI API key to
|
73 |
+
successfully use this space.
|
74 |
"""
|
75 |
)
|
76 |
gr.DuplicateButton(value="Duplicate Space for private use", elem_id="duplicate-button")
|
|
|
117 |
max_new_tokens = gr.Slider(
|
118 |
label='Max new tokens',
|
119 |
minimum=1,
|
120 |
+
maximum=2048,
|
121 |
step=1,
|
122 |
+
value=1024,
|
123 |
)
|
124 |
temperature = gr.Slider(
|
125 |
label='Temperature',
|
|
|
141 |
query.submit(respond, [openai_key, model, temperature, max_new_tokens, query, memory, chatbot], [query, memory, chatbot])
|
142 |
submit.click(respond, [openai_key, model, temperature, max_new_tokens, query, memory, chatbot], [query, memory, chatbot])
|
143 |
|
144 |
+
regenerate.click(regenerate_response, None, None)
|
145 |
+
clear_history.click(clear, None, [memory, chatbot])
|
146 |
|
147 |
demo.queue().launch()
|