Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ from datetime import datetime
|
|
15 |
from threading import RLock
|
16 |
lock = RLock()
|
17 |
HF_TOKEN = os.environ.get("ohgoddamn") if os.environ.get("ohgoddamn") else None # If private or gated models aren't used, ENV setting is unnecessary.
|
18 |
-
|
19 |
|
20 |
stop_event = asyncio.Event()
|
21 |
default_models = models[:howManyModelsToUse]
|
@@ -39,19 +39,29 @@ def random_choices():
|
|
39 |
return random.choices(models, k=num_models)
|
40 |
|
41 |
|
42 |
-
load_fn(models,HF_TOKEN)
|
43 |
|
44 |
|
45 |
-
client = InferenceClient( provider="hf-inference",
|
46 |
-
api_key=HF_TOKEN,)
|
47 |
-
image = client.text_to_image( "Astronaut riding a horse", model="charliebaby2023/cybrpny",)
|
48 |
-
print(f"{image}")
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
# === CONFIG ===
|
52 |
host = "api-inference.huggingface.co"
|
53 |
-
endpoint = "/models/charliebaby2023/cybrpny"
|
54 |
-
token = HF_TOKEN
|
55 |
prompt = "a futuristic city on Mars at sunset"
|
56 |
|
57 |
# === REQUEST SETUP ===
|
|
|
15 |
from threading import RLock
|
16 |
lock = RLock()
|
17 |
HF_TOKEN = os.environ.get("ohgoddamn") if os.environ.get("ohgoddamn") else None # If private or gated models aren't used, ENV setting is unnecessary.
|
18 |
+
token= os.environ.get("ohgoddamn") if os.environ.get("ohgoddamn") else None # If private or gated models aren't used, ENV setting is unnecessary.
|
19 |
|
20 |
stop_event = asyncio.Event()
|
21 |
default_models = models[:howManyModelsToUse]
|
|
|
39 |
return random.choices(models, k=num_models)
|
40 |
|
41 |
|
|
|
42 |
|
43 |
|
|
|
|
|
|
|
|
|
44 |
|
45 |
+
url = "https://api-inference.huggingface.co/models/charliebaby2023/cybrpny"
|
46 |
+
headers = { "Authorization": f"Bearer {token}"}
|
47 |
+
response = requests.get(url, headers=headers)
|
48 |
+
print(response.status_code)
|
49 |
+
print(response.text)
|
50 |
+
|
51 |
+
|
52 |
+
load_fn(models,HF_TOKEN)
|
53 |
+
|
54 |
+
|
55 |
+
#client = InferenceClient( provider="hf-inference", api_key=HF_TOKEN,)
|
56 |
+
#image = client.text_to_image( "Astronaut riding a horse", model="charliebaby2023/cybrpny",)
|
57 |
+
#print(f"{image}")
|
58 |
+
model_id = "CompVis/stable-diffusion-v1-4-original"
|
59 |
+
endpoint = f"/models/{model_id}"
|
60 |
|
61 |
# === CONFIG ===
|
62 |
host = "api-inference.huggingface.co"
|
63 |
+
#endpoint = "/models/charliebaby2023/cybrpny"
|
64 |
+
#token = HF_TOKEN
|
65 |
prompt = "a futuristic city on Mars at sunset"
|
66 |
|
67 |
# === REQUEST SETUP ===
|