kavansaun commited on
Commit
e95ddc4
·
verified ·
1 Parent(s): aa7cd83

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -33,7 +33,7 @@ with gr.Blocks(theme=gr.themes.Monochrome(),css="footer{display:none !important}
33
  user_dictionary[new_id].append({"role": "developer", "content": instructions}) # This line adds the instructions to the message history (as a developer) so it will always inhibit the instructions no matter what the user says.
34
 
35
  # Creating a new file with the new id to save the user responses and the chat bot responses to the repository
36
- repo = g.get_user().get_repo("CATDATA2")
37
  file_type = '.txt'
38
  filename = str(new_id) + file_type
39
  repo.create_file(filename, "Saving" + filename, "")
@@ -57,7 +57,7 @@ with gr.Blocks(theme=gr.themes.Monochrome(),css="footer{display:none !important}
57
  response = [(user_dictionary[user_id][i]["content"], user_dictionary[user_id][i+1]["content"]) for i in range(1, len(user_dictionary[user_id]), 2)] # Variable for the response
58
 
59
  # Repository details
60
- repo = g.get_user().get_repo("CATDATA2")
61
  commit_message = "Updating file content"
62
 
63
  # This chunk of code basically loops through the message history so we can update the save file with all the correct history in one piece of content.
@@ -87,12 +87,12 @@ with gr.Blocks(theme=gr.themes.Monochrome(),css="footer{display:none !important}
87
  return gr.Textbox(value = None, show_label = False, placeholder = initial_message, container = False)
88
 
89
  initial_message = "Please write your prompt here and press 'enter'" # Initial message for the User Interface (basically the message for the typing input area so change the message under the quotes if you want to change that)
90
- Chatbot = gr.Chatbot(label="Anonymous User",layout=['bubble']) # Creating a gradio-chatbot User Interface with the label "Anonymous User".
91
 
92
- txt = gr.Textbox(show_label=False, placeholder = initial_message, container=False, show_copy_button = False)
93
 
94
  txt.submit(fn = return_sent, inputs = None, outputs = txt)
95
  txt.submit(fn = predict_prompt, inputs = [txt, user_id], outputs = Chatbot, show_progress = 'hidden') # Adding the messages into the row with gradio.
96
  Chatbot.change(fn = return_placeholder, inputs = None, outputs = txt)
97
-
98
  chatblock.launch() # launch!
 
33
  user_dictionary[new_id].append({"role": "developer", "content": instructions}) # This line adds the instructions to the message history (as a developer) so it will always inhibit the instructions no matter what the user says.
34
 
35
  # Creating a new file with the new id to save the user responses and the chat bot responses to the repository
36
+ repo = g.get_user().get_repo("CATDATA1")
37
  file_type = '.txt'
38
  filename = str(new_id) + file_type
39
  repo.create_file(filename, "Saving" + filename, "")
 
57
  response = [(user_dictionary[user_id][i]["content"], user_dictionary[user_id][i+1]["content"]) for i in range(1, len(user_dictionary[user_id]), 2)] # Variable for the response
58
 
59
  # Repository details
60
+ repo = g.get_user().get_repo("CATDATA")
61
  commit_message = "Updating file content"
62
 
63
  # This chunk of code basically loops through the message history so we can update the save file with all the correct history in one piece of content.
 
87
  return gr.Textbox(value = None, show_label = False, placeholder = initial_message, container = False)
88
 
89
  initial_message = "Please write your prompt here and press 'enter'" # Initial message for the User Interface (basically the message for the typing input area so change the message under the quotes if you want to change that)
90
+ Chatbot = gr.Chatbot(label="Anonymous User",layout=['bubble'],show_share_button = False,show_copy_button = False) # Creating a gradio-chatbot User Interface with the label "Anonymous User".
91
 
92
+ txt = gr.Textbox(show_label = False, placeholder = initial_message, container = False)
93
 
94
  txt.submit(fn = return_sent, inputs = None, outputs = txt)
95
  txt.submit(fn = predict_prompt, inputs = [txt, user_id], outputs = Chatbot, show_progress = 'hidden') # Adding the messages into the row with gradio.
96
  Chatbot.change(fn = return_placeholder, inputs = None, outputs = txt)
97
+
98
  chatblock.launch() # launch!