Delete app.py
Browse files
app.py
DELETED
|
@@ -1,22 +0,0 @@
|
|
| 1 |
-
from transformers import HfApi
|
| 2 |
-
|
| 3 |
-
def upload_file_to_huggingface(file_url, filename, api_token):
|
| 4 |
-
# Download the file from the URL
|
| 5 |
-
response = requests.get(file_url)
|
| 6 |
-
file_content = response.content
|
| 7 |
-
|
| 8 |
-
# Initialize the Hugging Face API client
|
| 9 |
-
hf_api = HfApi()
|
| 10 |
-
hf_api.set_access_token(api_token)
|
| 11 |
-
|
| 12 |
-
# Upload the file to Hugging Face
|
| 13 |
-
hf_api.upload_file(filename, file_content)
|
| 14 |
-
|
| 15 |
-
print(f"File uploaded to Hugging Face as {filename}")
|
| 16 |
-
|
| 17 |
-
# Replace 'your-api-token' with your actual Hugging Face API token
|
| 18 |
-
api_token = '26c6255b595c4aac4c30f7fa6644c1a726b70972_1694005299.jpg'
|
| 19 |
-
file_url = 'https://dkstatics-public.digikala.com/digikala-products/26c6255b595c4aac4c30f7fa6644c1a726b70972_1694005299.jpg'
|
| 20 |
-
filename = '26c6255b595c4aac4c30f7fa6644c1a726b70972_1694005299.jpg'
|
| 21 |
-
|
| 22 |
-
upload_file_to_huggingface(file_url, filename, api_token)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|