Spaces:
Runtime error
Runtime error
Commit
·
bf06365
1
Parent(s):
06efe94
Update app.py
Browse files
app.py
CHANGED
@@ -53,7 +53,7 @@ block = gr.Blocks(css=".gradio-container {background-color: lightgray}")
|
|
53 |
|
54 |
with block:
|
55 |
with gr.Row():
|
56 |
-
gr.Markdown("<h3><center>Chat-
|
57 |
|
58 |
openai_api_key_textbox = gr.Textbox(
|
59 |
placeholder="Paste your OpenAI API key (sk-...)",
|
@@ -87,13 +87,20 @@ with block:
|
|
87 |
state = gr.State()
|
88 |
agent_state = gr.State()
|
89 |
|
90 |
-
submit.click(chat, inputs=[openai_api_key_textbox, message, state, agent_state], outputs=[chatbot, state])
|
91 |
-
message.submit(chat, inputs=[openai_api_key_textbox, message, state, agent_state], outputs=[chatbot, state]
|
92 |
|
93 |
openai_api_key_textbox.change(
|
94 |
set_openai_api_key,
|
95 |
inputs=[openai_api_key_textbox],
|
96 |
outputs=[agent_state],
|
97 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
block.launch(debug=True)
|
|
|
53 |
|
54 |
with block:
|
55 |
with gr.Row():
|
56 |
+
gr.Markdown("<h3><center>Chat about - State-of-the-Union</center></h3>")
|
57 |
|
58 |
openai_api_key_textbox = gr.Textbox(
|
59 |
placeholder="Paste your OpenAI API key (sk-...)",
|
|
|
87 |
state = gr.State()
|
88 |
agent_state = gr.State()
|
89 |
|
90 |
+
submit.click(chat, inputs=[openai_api_key_textbox, message, state, agent_state], outputs=[chatbot, state],api_name="chat")
|
91 |
+
message.submit(chat, inputs=[openai_api_key_textbox, message, state, agent_state], outputs=[chatbot, state])
|
92 |
|
93 |
openai_api_key_textbox.change(
|
94 |
set_openai_api_key,
|
95 |
inputs=[openai_api_key_textbox],
|
96 |
outputs=[agent_state],
|
97 |
)
|
98 |
+
def echo(name, request: gr.Request):
|
99 |
+
if request:
|
100 |
+
print("Request headers dictionary:", request.headers)
|
101 |
+
print("IP address:", request.client.host)
|
102 |
+
print("Body", request.body)
|
103 |
+
return name
|
104 |
+
|
105 |
|
106 |
block.launch(debug=True)
|