Spaces:
Runtime error
Runtime error
ceckenrode
commited on
Commit
•
d050d5c
1
Parent(s):
c2665e5
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
|
|
2 |
import os
|
3 |
import json
|
4 |
import requests
|
|
|
5 |
|
6 |
#Streaming endpoint
|
7 |
API_URL = "https://api.openai.com/v1/chat/completions" #os.getenv("API_URL") + "/generate_stream"
|
@@ -144,9 +145,9 @@ def append_file(file_path, content):
|
|
144 |
return "Error occurred while appending to file."
|
145 |
|
146 |
def download_csv(file_path):
|
147 |
-
|
148 |
-
|
149 |
-
b64 = base64.b64encode(
|
150 |
href = f'<a href="data:application/octet-stream;base64,{b64}" download="{file_path}">Download</a>'
|
151 |
return href
|
152 |
|
|
|
2 |
import os
|
3 |
import json
|
4 |
import requests
|
5 |
+
import pandas as pd
|
6 |
|
7 |
#Streaming endpoint
|
8 |
API_URL = "https://api.openai.com/v1/chat/completions" #os.getenv("API_URL") + "/generate_stream"
|
|
|
145 |
return "Error occurred while appending to file."
|
146 |
|
147 |
def download_csv(file_path):
|
148 |
+
df = pd.read_csv(file_path)
|
149 |
+
csv = df.to_csv(index=False)
|
150 |
+
b64 = base64.b64encode(csv.encode()).decode()
|
151 |
href = f'<a href="data:application/octet-stream;base64,{b64}" download="{file_path}">Download</a>'
|
152 |
return href
|
153 |
|