Spaces:
Running
Running
Update app.R
Browse files
app.R
CHANGED
|
@@ -1999,10 +1999,11 @@ observeEvent(input$upload_hf_btn, {
|
|
| 1999 |
arrow::write_parquet(combined, tmp)
|
| 2000 |
|
| 2001 |
result <- tryCatch({
|
| 2002 |
-
|
|
|
|
| 2003 |
'{"summary":"Update %s","operations":[{"key":"file0","path_in_repo":"%s"}]}',
|
| 2004 |
filename, filename
|
| 2005 |
-
)
|
| 2006 |
|
| 2007 |
h <- curl::new_handle()
|
| 2008 |
curl::handle_setheaders(h,
|
|
@@ -2010,7 +2011,7 @@ result <- tryCatch({
|
|
| 2010 |
)
|
| 2011 |
|
| 2012 |
curl::handle_setform(h,
|
| 2013 |
-
header = curl::
|
| 2014 |
file0 = curl::form_file(tmp, type = "application/octet-stream")
|
| 2015 |
)
|
| 2016 |
|
|
@@ -2019,6 +2020,8 @@ result <- tryCatch({
|
|
| 2019 |
handle = h
|
| 2020 |
)
|
| 2021 |
|
|
|
|
|
|
|
| 2022 |
resp_text <- rawToChar(resp$content)
|
| 2023 |
|
| 2024 |
if (resp$status_code %in% c(200, 201)) {
|
|
|
|
| 1999 |
arrow::write_parquet(combined, tmp)
|
| 2000 |
|
| 2001 |
result <- tryCatch({
|
| 2002 |
+
header_file <- tempfile(fileext = ".json")
|
| 2003 |
+
writeLines(sprintf(
|
| 2004 |
'{"summary":"Update %s","operations":[{"key":"file0","path_in_repo":"%s"}]}',
|
| 2005 |
filename, filename
|
| 2006 |
+
), header_file)
|
| 2007 |
|
| 2008 |
h <- curl::new_handle()
|
| 2009 |
curl::handle_setheaders(h,
|
|
|
|
| 2011 |
)
|
| 2012 |
|
| 2013 |
curl::handle_setform(h,
|
| 2014 |
+
header = curl::form_file(header_file, type = "application/json"),
|
| 2015 |
file0 = curl::form_file(tmp, type = "application/octet-stream")
|
| 2016 |
)
|
| 2017 |
|
|
|
|
| 2020 |
handle = h
|
| 2021 |
)
|
| 2022 |
|
| 2023 |
+
file.remove(header_file)
|
| 2024 |
+
|
| 2025 |
resp_text <- rawToChar(resp$content)
|
| 2026 |
|
| 2027 |
if (resp$status_code %in% c(200, 201)) {
|