Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -30,9 +30,12 @@ def create_file(filename, prompt, response):
|
|
30 |
file.write(f"<h1>Prompt:</h1> <p>{prompt}</p> <h1>Response:</h1> <p>{response}</p>")
|
31 |
|
32 |
def get_table_download_link(file_path):
|
33 |
-
|
|
|
|
|
|
|
34 |
return href
|
35 |
-
|
36 |
def main():
|
37 |
st.title("Chat with AI")
|
38 |
|
|
|
30 |
file.write(f"<h1>Prompt:</h1> <p>{prompt}</p> <h1>Response:</h1> <p>{response}</p>")
|
31 |
|
32 |
def get_table_download_link(file_path):
|
33 |
+
with open(file_path, 'r') as file:
|
34 |
+
data = file.read()
|
35 |
+
b64 = base64.b64encode(data.encode()).decode()
|
36 |
+
href = f'<a href="data:file/txt;base64,{b64}" download="{os.path.basename(file_path)}">{os.path.basename(file_path)}</a>'
|
37 |
return href
|
38 |
+
|
39 |
def main():
|
40 |
st.title("Chat with AI")
|
41 |
|