revert
Browse files
app.py
CHANGED
@@ -2,7 +2,6 @@ import os
|
|
2 |
|
3 |
import gradio as gr
|
4 |
import numpy as np
|
5 |
-
import requests
|
6 |
from dotenv import load_dotenv
|
7 |
from huggingface_hub import InferenceClient, login
|
8 |
|
@@ -13,21 +12,6 @@ MAX_IMAGE_SIZE = 2048
|
|
13 |
TOKEN = None
|
14 |
|
15 |
|
16 |
-
def download_image_locally(image_url: str, local_path: str):
|
17 |
-
"""
|
18 |
-
Download an image from a URL to a local path.
|
19 |
-
|
20 |
-
Args:
|
21 |
-
image_url (str):
|
22 |
-
The URL of the image to download.
|
23 |
-
local_path (str):
|
24 |
-
The path to save the downloaded image.
|
25 |
-
"""
|
26 |
-
response = requests.get(image_url)
|
27 |
-
with open(local_path, "wb") as f:
|
28 |
-
f.write(response.content)
|
29 |
-
return local_path
|
30 |
-
|
31 |
def get_token(oauth_token: gr.OAuthToken | None):
|
32 |
global TOKEN
|
33 |
if oauth_token and oauth_token.token:
|
|
|
2 |
|
3 |
import gradio as gr
|
4 |
import numpy as np
|
|
|
5 |
from dotenv import load_dotenv
|
6 |
from huggingface_hub import InferenceClient, login
|
7 |
|
|
|
12 |
TOKEN = None
|
13 |
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
def get_token(oauth_token: gr.OAuthToken | None):
|
16 |
global TOKEN
|
17 |
if oauth_token and oauth_token.token:
|