Update app.py
Browse files
app.py
CHANGED
|
@@ -90,9 +90,9 @@ def save_feedback(user_input, response, feedback_type, improvement):
|
|
| 90 |
}
|
| 91 |
print(f"Saving feedback: {feedback}")
|
| 92 |
# Append to the dataset
|
| 93 |
-
new_data = {"user_input":
|
| 94 |
global dataset
|
| 95 |
-
dataset
|
| 96 |
dataset.push_to_hub(DATASET_NAME)
|
| 97 |
|
| 98 |
def handle_feedback(response, feedback_type, improvement):
|
|
@@ -134,6 +134,9 @@ with gr.Blocks() as iface:
|
|
| 134 |
with gr.Row():
|
| 135 |
user_input = gr.Textbox(label='歡迎問我關於「高熵合金」(High-entropy alloys) 的各種疑難雜症', lines=2, placeholder="在此輸入問題...")
|
| 136 |
submit_button = gr.Button("提交")
|
|
|
|
|
|
|
|
|
|
| 137 |
with gr.Row():
|
| 138 |
response_output = gr.Textbox(label='模型回應', interactive=False)
|
| 139 |
with gr.Row():
|
|
@@ -162,6 +165,5 @@ with gr.Blocks() as iface:
|
|
| 162 |
|
| 163 |
show_feedback_button.click(fn=show_feedback, outputs=feedback_display)
|
| 164 |
|
| 165 |
-
gr.Examples(examples=examples, inputs=user_input)
|
| 166 |
|
| 167 |
iface.launch()
|
|
|
|
| 90 |
}
|
| 91 |
print(f"Saving feedback: {feedback}")
|
| 92 |
# Append to the dataset
|
| 93 |
+
new_data = {"user_input": user_input, "response": response, "feedback_type": feedback_type, "improvement": improvement}
|
| 94 |
global dataset
|
| 95 |
+
dataset = dataset["feedback"].add_item(new_data)
|
| 96 |
dataset.push_to_hub(DATASET_NAME)
|
| 97 |
|
| 98 |
def handle_feedback(response, feedback_type, improvement):
|
|
|
|
| 134 |
with gr.Row():
|
| 135 |
user_input = gr.Textbox(label='歡迎問我關於「高熵合金」(High-entropy alloys) 的各種疑難雜症', lines=2, placeholder="在此輸入問題...")
|
| 136 |
submit_button = gr.Button("提交")
|
| 137 |
+
|
| 138 |
+
gr.Examples(examples=examples, inputs=user_input)
|
| 139 |
+
|
| 140 |
with gr.Row():
|
| 141 |
response_output = gr.Textbox(label='模型回應', interactive=False)
|
| 142 |
with gr.Row():
|
|
|
|
| 165 |
|
| 166 |
show_feedback_button.click(fn=show_feedback, outputs=feedback_display)
|
| 167 |
|
|
|
|
| 168 |
|
| 169 |
iface.launch()
|