Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -41,7 +41,6 @@ def chat_fn(message, history, system_prompt, temperature, model_name):
|
|
41 |
delta = chunk.choices[0].delta
|
42 |
if delta and delta.content:
|
43 |
partial += delta.content
|
44 |
-
# Yield the *current* partial answer (Gradio replaces the prior one)
|
45 |
yield partial
|
46 |
|
47 |
with gr.Blocks(title="OpenAI x Gradio Chat") as demo:
|
@@ -53,6 +52,7 @@ with gr.Blocks(title="OpenAI x Gradio Chat") as demo:
|
|
53 |
label="System prompt",
|
54 |
lines=2
|
55 |
)
|
|
|
56 |
with gr.Row():
|
57 |
model_name = gr.Dropdown(
|
58 |
choices=["gpt-4o-mini", "gpt-4o", "gpt-5"],
|
@@ -68,11 +68,7 @@ with gr.Blocks(title="OpenAI x Gradio Chat") as demo:
|
|
68 |
textbox=gr.Textbox(placeholder="Ask me anything…"),
|
69 |
examples=["Explain transformers in one paragraph", "Write a dad joke about databases"],
|
70 |
cache_examples=False,
|
71 |
-
|
72 |
-
retry_btn="Regenerate",
|
73 |
-
undo_btn="Remove last",
|
74 |
-
clear_btn="Clear",
|
75 |
-
save_history=True, # saves chat logs (CSV) in Space filesystem
|
76 |
flagging_mode="manual",
|
77 |
flagging_options=["👍 Useful", "👎 Not good", "⚠ Inaccurate"],
|
78 |
)
|
|
|
41 |
delta = chunk.choices[0].delta
|
42 |
if delta and delta.content:
|
43 |
partial += delta.content
|
|
|
44 |
yield partial
|
45 |
|
46 |
with gr.Blocks(title="OpenAI x Gradio Chat") as demo:
|
|
|
52 |
label="System prompt",
|
53 |
lines=2
|
54 |
)
|
55 |
+
|
56 |
with gr.Row():
|
57 |
model_name = gr.Dropdown(
|
58 |
choices=["gpt-4o-mini", "gpt-4o", "gpt-5"],
|
|
|
68 |
textbox=gr.Textbox(placeholder="Ask me anything…"),
|
69 |
examples=["Explain transformers in one paragraph", "Write a dad joke about databases"],
|
70 |
cache_examples=False,
|
71 |
+
save_history=True, # saves chat logs
|
|
|
|
|
|
|
|
|
72 |
flagging_mode="manual",
|
73 |
flagging_options=["👍 Useful", "👎 Not good", "⚠ Inaccurate"],
|
74 |
)
|