Huanzhi Mao
commited on
Commit
Β·
aad7801
1
Parent(s):
b9ab8a4
make alert prettier
Browse files
app.py
CHANGED
|
@@ -934,7 +934,7 @@ def send_feedback(prompt, function, model, temperature, codeOutput, jsonOutput,
|
|
| 934 |
headers = {'Content-Type': 'application/json'}
|
| 935 |
login_data = {
|
| 936 |
'username': 'website',
|
| 937 |
-
'password':
|
| 938 |
}
|
| 939 |
response = requests.post(login_url, headers=headers, json=login_data)
|
| 940 |
access_token = response.json()['access_token']
|
|
@@ -973,10 +973,12 @@ def send_feedback(prompt, function, model, temperature, codeOutput, jsonOutput,
|
|
| 973 |
print('Error:', response.text)
|
| 974 |
|
| 975 |
def send_feedback_negative(prompt, function, model, temperature, codeOutput, jsonOutput):
|
| 976 |
-
|
|
|
|
| 977 |
|
| 978 |
def send_feedback_positive(prompt, function, model, temperature, codeOutput, jsonOutput):
|
| 979 |
-
|
|
|
|
| 980 |
|
| 981 |
|
| 982 |
def report_issue(prompt, model, temperature, codeOutput, jsonOutput):
|
|
@@ -1240,7 +1242,7 @@ with gr.Blocks() as demo:
|
|
| 1240 |
thumbs_down = gr.Button("π")
|
| 1241 |
regenerate_button = gr.Button("Regenerate")
|
| 1242 |
report_issue_button = gr.Button("Report Issue")
|
| 1243 |
-
|
| 1244 |
|
| 1245 |
# Actions
|
| 1246 |
submit_button.click(
|
|
@@ -1265,15 +1267,13 @@ with gr.Blocks() as demo:
|
|
| 1265 |
thumbs_up.click(
|
| 1266 |
fn=send_feedback_positive,
|
| 1267 |
inputs=[prompt, funcDescription, model, temperature, codeOutput, jsonOutput],
|
| 1268 |
-
outputs=[],
|
| 1269 |
-
js='() => { alert("Thanks for the feedback!"); }'
|
| 1270 |
)
|
| 1271 |
|
| 1272 |
thumbs_down.click(
|
| 1273 |
fn=send_feedback_negative,
|
| 1274 |
inputs=[prompt, funcDescription, model, temperature, codeOutput, jsonOutput],
|
| 1275 |
-
outputs=[],
|
| 1276 |
-
js='() => { alert("Thanks for the feedback!"); }'
|
| 1277 |
)
|
| 1278 |
|
| 1279 |
demo.launch()
|
|
|
|
| 934 |
headers = {'Content-Type': 'application/json'}
|
| 935 |
login_data = {
|
| 936 |
'username': 'website',
|
| 937 |
+
'password': mongoDBPassword
|
| 938 |
}
|
| 939 |
response = requests.post(login_url, headers=headers, json=login_data)
|
| 940 |
access_token = response.json()['access_token']
|
|
|
|
| 973 |
print('Error:', response.text)
|
| 974 |
|
| 975 |
def send_feedback_negative(prompt, function, model, temperature, codeOutput, jsonOutput):
|
| 976 |
+
send_feedback(prompt, function, model, temperature, codeOutput, jsonOutput, "negative")
|
| 977 |
+
return "Thank you for your feedback. We will use this to improve our service."
|
| 978 |
|
| 979 |
def send_feedback_positive(prompt, function, model, temperature, codeOutput, jsonOutput):
|
| 980 |
+
send_feedback(prompt, function, model, temperature, codeOutput, jsonOutput, "positive")
|
| 981 |
+
return "Thank you for your feedback. We will use this to improve our service."
|
| 982 |
|
| 983 |
|
| 984 |
def report_issue(prompt, model, temperature, codeOutput, jsonOutput):
|
|
|
|
| 1242 |
thumbs_down = gr.Button("π")
|
| 1243 |
regenerate_button = gr.Button("Regenerate")
|
| 1244 |
report_issue_button = gr.Button("Report Issue")
|
| 1245 |
+
feedbackMsg = gr.Markdown()
|
| 1246 |
|
| 1247 |
# Actions
|
| 1248 |
submit_button.click(
|
|
|
|
| 1267 |
thumbs_up.click(
|
| 1268 |
fn=send_feedback_positive,
|
| 1269 |
inputs=[prompt, funcDescription, model, temperature, codeOutput, jsonOutput],
|
| 1270 |
+
outputs=[feedbackMsg],
|
|
|
|
| 1271 |
)
|
| 1272 |
|
| 1273 |
thumbs_down.click(
|
| 1274 |
fn=send_feedback_negative,
|
| 1275 |
inputs=[prompt, funcDescription, model, temperature, codeOutput, jsonOutput],
|
| 1276 |
+
outputs=[feedbackMsg],
|
|
|
|
| 1277 |
)
|
| 1278 |
|
| 1279 |
demo.launch()
|