Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -145,10 +145,14 @@ def clear_all(history, uploaded_file_paths):
|
|
| 145 |
chats[0]=summary
|
| 146 |
|
| 147 |
#file_path_download = save_and_download(summary)
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
with open(file_path_download, 'w') as file:
|
| 153 |
# String in die Datei schreiben
|
| 154 |
file.write(summary)
|
|
|
|
| 145 |
chats[0]=summary
|
| 146 |
|
| 147 |
#file_path_download = save_and_download(summary)
|
| 148 |
+
headers, payload = process_chatverlauf("Gib eine Überschrift aus maximal 2 Worten zu folgendem Text an", MODEL_NAME, OAI_API_KEY)
|
| 149 |
+
response = requests.post("https://api.openai.com/v1/chat/completions", headers=headers, json=payload)
|
| 150 |
+
#als json ausgeben
|
| 151 |
+
data = response.json()
|
| 152 |
+
# Den "content" auswählen, da dort die Antwort der Ki enthalten ist
|
| 153 |
+
result = data['choices'][0]['message']['content']
|
| 154 |
+
print (result)
|
| 155 |
+
file_path_download = "data/" + str(len(chats)) + "_" + result
|
| 156 |
with open(file_path_download, 'w') as file:
|
| 157 |
# String in die Datei schreiben
|
| 158 |
file.write(summary)
|