Spaces:
Runtime error
Runtime error
Commit
·
0a5247e
1
Parent(s):
dddb041
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,12 +40,13 @@ with gr.Blocks(css="custom.css") as demo:
|
|
| 40 |
selected_lora = loras[selected_state]
|
| 41 |
api_url = f"https://api-inference.huggingface.co/models/{selected_lora['repo']}"
|
| 42 |
trigger_word = selected_lora["trigger_word"]
|
| 43 |
-
token = os.getenv("API_TOKEN")
|
| 44 |
payload = {"inputs": f"{prompt} {trigger_word}"}
|
| 45 |
|
| 46 |
image_bytes = query(payload, api_url, token)
|
| 47 |
return Image.open(image_bytes)
|
| 48 |
|
|
|
|
| 49 |
prompt.submit(
|
| 50 |
fn=run_lora,
|
| 51 |
inputs=[prompt, weight, selected_state],
|
|
|
|
| 40 |
selected_lora = loras[selected_state]
|
| 41 |
api_url = f"https://api-inference.huggingface.co/models/{selected_lora['repo']}"
|
| 42 |
trigger_word = selected_lora["trigger_word"]
|
| 43 |
+
token = os.getenv("API_TOKEN") # This will read the API token set in your managed environment
|
| 44 |
payload = {"inputs": f"{prompt} {trigger_word}"}
|
| 45 |
|
| 46 |
image_bytes = query(payload, api_url, token)
|
| 47 |
return Image.open(image_bytes)
|
| 48 |
|
| 49 |
+
|
| 50 |
prompt.submit(
|
| 51 |
fn=run_lora,
|
| 52 |
inputs=[prompt, weight, selected_state],
|