Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,20 +26,6 @@ with gr.Blocks(theme=gr.themes.Monochrome(),css="footer{display:none !important}
|
|
| 26 |
repo = g.get_user().get_repo("CATDATA")
|
| 27 |
filename = str(new_id) + '.txt'
|
| 28 |
repo.create_file(filename, "Saving" + filename, "")
|
| 29 |
-
|
| 30 |
-
# variable content store each message found in the message history and states the respective user. This is for the content to add in the file
|
| 31 |
-
content = ''
|
| 32 |
-
for i in range(1,len(message_history), 1):
|
| 33 |
-
if (i % 2 == 1) and (message_history[i]["role"] == "user"):
|
| 34 |
-
content += ('User: ' + message_history[i]["content"] + '\n')
|
| 35 |
-
if (i % 2 == 0) and (message_history[i]["role"] == "assistant"):
|
| 36 |
-
content += ('Bot: ' + message_history[i]["content"] + '\n')
|
| 37 |
-
else:
|
| 38 |
-
content += ''
|
| 39 |
-
|
| 40 |
-
#updating the repository with the entire message history
|
| 41 |
-
file = repo.get_contents(file_path)
|
| 42 |
-
repo.update_file(file.path, commit_message, content, file.sha)
|
| 43 |
|
| 44 |
return gr.Markdown(f"<h1><center> Session Id: {new_id} </center></h1>",visible=True) # Returning the "Markdown" object with what we want.
|
| 45 |
|
|
|
|
| 26 |
repo = g.get_user().get_repo("CATDATA")
|
| 27 |
filename = str(new_id) + '.txt'
|
| 28 |
repo.create_file(filename, "Saving" + filename, "")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
return gr.Markdown(f"<h1><center> Session Id: {new_id} </center></h1>",visible=True) # Returning the "Markdown" object with what we want.
|
| 31 |
|