Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ gc = gspread.service_account(filename='botresponse-6f1a8c749aa0.json')
|
|
12 |
sheet_id = "18hnoTsEaGMWMael42MXubb-FzAe5jJB5RpaSolIXyb0"
|
13 |
worksheet_name = "Sheet1"
|
14 |
|
15 |
-
def feedback_response(feedback, comments):
|
16 |
response = ''
|
17 |
if feedback == 'Good Response':
|
18 |
response = 'Good Response!'
|
@@ -20,17 +20,13 @@ def feedback_response(feedback, comments):
|
|
20 |
response = 'Bad Response'
|
21 |
else:
|
22 |
response = 'Inappropriate response!'
|
23 |
-
if comments:
|
24 |
-
comments = comments
|
25 |
-
|
26 |
-
|
27 |
|
28 |
# Open the Google Sheets document
|
29 |
sh = gc.open_by_key(sheet_id)
|
30 |
worksheet = sh.worksheet(worksheet_name)
|
31 |
|
32 |
-
# Create a DataFrame from the response
|
33 |
-
df = pd.DataFrame({'Response': [response],'Additional Comments': [comments]})
|
34 |
|
35 |
# Append the data to the worksheet
|
36 |
worksheet.append_rows(df.values.tolist())
|
@@ -49,10 +45,11 @@ feedback_interface = gr.Interface(
|
|
49 |
],
|
50 |
label="Feedback"
|
51 |
),
|
52 |
-
gr.Textbox(label="Additional Comments")
|
|
|
53 |
],
|
54 |
-
outputs=
|
55 |
)
|
56 |
|
57 |
# Launch the interface
|
58 |
-
feedback_interface.launch()
|
|
|
12 |
sheet_id = "18hnoTsEaGMWMael42MXubb-FzAe5jJB5RpaSolIXyb0"
|
13 |
worksheet_name = "Sheet1"
|
14 |
|
15 |
+
def feedback_response(feedback, comments, new_input_query):
|
16 |
response = ''
|
17 |
if feedback == 'Good Response':
|
18 |
response = 'Good Response!'
|
|
|
20 |
response = 'Bad Response'
|
21 |
else:
|
22 |
response = 'Inappropriate response!'
|
|
|
|
|
|
|
|
|
23 |
|
24 |
# Open the Google Sheets document
|
25 |
sh = gc.open_by_key(sheet_id)
|
26 |
worksheet = sh.worksheet(worksheet_name)
|
27 |
|
28 |
+
# Create a DataFrame from the response and additional comments
|
29 |
+
df = pd.DataFrame({'Response': [response], 'Additional Comments': [comments], 'New Input Query': [new_input_query]})
|
30 |
|
31 |
# Append the data to the worksheet
|
32 |
worksheet.append_rows(df.values.tolist())
|
|
|
45 |
],
|
46 |
label="Feedback"
|
47 |
),
|
48 |
+
gr.Textbox(label="Additional Comments"),
|
49 |
+
gr.Textbox(label="New Input Query")
|
50 |
],
|
51 |
+
outputs="text"
|
52 |
)
|
53 |
|
54 |
# Launch the interface
|
55 |
+
feedback_interface.launch()
|