knakamura924 commited on
Commit
ec2c0ad
·
1 Parent(s): 162aefa

Fixed Safari issue with gr.Text

Browse files
Files changed (1) hide show
  1. app.py +8 -24
app.py CHANGED
@@ -239,7 +239,7 @@ def upload_interview(
239
  def end_interview(
240
  session_id: str,
241
  chat_history: list[list[str | None]],
242
- ) -> list[list[str | None]]:
243
  """Create completion code and display in chat interface."""
244
  completion_message = (
245
  "Thank you for participating.\n\n"
@@ -248,31 +248,12 @@ def end_interview(
248
  "and paste this code into the completion "
249
  "code box.".format(generate_completion_code())
250
  )
251
- chat_history += [[None, completion_message]]
252
  upload_interview(session_id, chat_history)
253
- return chat_history
254
-
255
- #to be able to select the text on chatbot
256
- css = """
257
- .chatbox * {
258
- -webkit-user-select: text; /* Safari */
259
- -moz-user-select: text; /* Firefox */
260
- -ms-user-select: text; /* Internet Explorer/Edge */
261
- user-select: text; /* Non-prefixed version, currently supported by Chrome, Edge, Opera and Firefox */
262
- cursor: text; /* Ensure the cursor changes to text selection mode */
263
- }
264
-
265
- #chatDisplay .message {
266
- -webkit-user-select: text; /* Safari */
267
- -moz-user-select: text; /* Firefox */
268
- -ms-user-select: text; /* Internet Explorer/Edge */
269
- user-select: text; /* Non-prefixed version, currently supported by Chrome, Edge, Opera and Firefox */
270
- cursor: text; /* Ensure the cursor changes to text selection mode */
271
- }
272
- """
273
 
274
  # LAYOUT
275
- with gr.Blocks(theme="sudeepshouche/minimalist", css = css) as demo:
276
  # Header and instructions
277
  gr.Markdown("# SurveyGPT Interview")
278
  instructionText = gr.Markdown(
@@ -298,6 +279,9 @@ with gr.Blocks(theme="sudeepshouche/minimalist", css = css) as demo:
298
  show_label=False,
299
  visible=True,
300
  )
 
 
 
301
  with gr.Row(): # Interaction
302
  chatInput = gr.Textbox(
303
  placeholder="Click 'Start Interview' to begin.",
@@ -393,7 +377,7 @@ with gr.Blocks(theme="sudeepshouche/minimalist", css = css) as demo:
393
 
394
  # Reset button
395
  exitButton.click(
396
- end_interview, inputs=[sessionId, chatDisplay], outputs=[chatDisplay]
397
  )
398
  # testExitButton.click(
399
  # end_interview, inputs=[sessionId, chatDisplay], outputs=[chatDisplay]
 
239
  def end_interview(
240
  session_id: str,
241
  chat_history: list[list[str | None]],
242
+ ) -> tuple[list[list[str | None]], gr.Text]:
243
  """Create completion code and display in chat interface."""
244
  completion_message = (
245
  "Thank you for participating.\n\n"
 
248
  "and paste this code into the completion "
249
  "code box.".format(generate_completion_code())
250
  )
 
251
  upload_interview(session_id, chat_history)
252
+ EndMessage = gr.Text(completion_message, visible=True, show_label=False, scale=10)
253
+ return chat_history, EndMessage
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
254
 
255
  # LAYOUT
256
+ with gr.Blocks(theme="sudeepshouche/minimalist") as demo:
257
  # Header and instructions
258
  gr.Markdown("# SurveyGPT Interview")
259
  instructionText = gr.Markdown(
 
279
  show_label=False,
280
  visible=True,
281
  )
282
+
283
+ EndMessage = gr.Text("", visible=False, show_label=False, scale=10)
284
+
285
  with gr.Row(): # Interaction
286
  chatInput = gr.Textbox(
287
  placeholder="Click 'Start Interview' to begin.",
 
377
 
378
  # Reset button
379
  exitButton.click(
380
+ end_interview, inputs=[sessionId, chatDisplay], outputs=[chatDisplay, EndMessage]
381
  )
382
  # testExitButton.click(
383
  # end_interview, inputs=[sessionId, chatDisplay], outputs=[chatDisplay]