mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-17 15:42:37 +00:00
rag page
This commit is contained in:
parent
5d9faca81b
commit
2ecbbd92ed
2 changed files with 161 additions and 22 deletions
|
|
@ -4,6 +4,7 @@
|
|||
# This source code is licensed under the terms described in the LICENSE file in
|
||||
# the root directory of this source tree.
|
||||
|
||||
import base64
|
||||
import os
|
||||
|
||||
import pandas as pd
|
||||
|
|
@ -29,3 +30,13 @@ def process_dataset(file):
|
|||
except Exception as e:
|
||||
st.error(f"Error processing file: {str(e)}")
|
||||
return None
|
||||
|
||||
|
||||
def data_url_from_file(file) -> str:
|
||||
file_content = file.getvalue()
|
||||
base64_content = base64.b64encode(file_content).decode("utf-8")
|
||||
mime_type = file.type
|
||||
|
||||
data_url = f"data:{mime_type};base64,{base64_content}"
|
||||
|
||||
return data_url
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue