up / app.py
sanaweb's picture
Create app.py
66c560c verified
raw
history blame contribute delete
No virus
938 Bytes
import streamlit as st
x = st.slider('Select a value')
st.write(x, 'squared is', x * x)
from transformers import HfApi
def upload_file_to_huggingface(file_url, filename, api_token):
# Download the file from the URL
response = requests.get(file_url)
file_content = response.content
# Initialize the Hugging Face API client
hf_api = HfApi()
hf_api.set_access_token(api_token)
# Upload the file to Hugging Face
hf_api.upload_file(filename, file_content)
print(f"File uploaded to Hugging Face as {filename}")
# Replace 'your-api-token' with your actual Hugging Face API token
api_token = '26c6255b595c4aac4c30f7fa6644c1a726b70972_1694005299.jpg'
file_url = 'https://dkstatics-public.digikala.com/digikala-products/26c6255b595c4aac4c30f7fa6644c1a726b70972_1694005299.jpg'
filename = '26c6255b595c4aac4c30f7fa6644c1a726b70972_1694005299.jpg'
upload_file_to_huggingface(file_url, filename, api_token)