Spaces:
Runtime error
Runtime error
Commit
·
322db57
1
Parent(s):
db08793
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,6 +35,12 @@ def run_lora(prompt, selected_state, progress=gr.Progress(track_tqdm=True)):
|
|
| 35 |
payload = {"inputs": f"{prompt} {trigger_word}"}
|
| 36 |
|
| 37 |
headers = {"Authorization": f"Bearer {token}"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
response = requests.post(api_url, headers=headers, json=payload)
|
| 39 |
if response.status_code == 200:
|
| 40 |
return Image.open(io.BytesIO(response.content))
|
|
@@ -43,6 +49,7 @@ def run_lora(prompt, selected_state, progress=gr.Progress(track_tqdm=True)):
|
|
| 43 |
raise gr.Error("API Error: Unable to fetch the image.") # Raise a Gradio error here
|
| 44 |
|
| 45 |
|
|
|
|
| 46 |
with gr.Blocks(css="custom.css") as app:
|
| 47 |
title = gr.HTML("<h1>LoRA the Explorer</h1>")
|
| 48 |
selected_state = gr.State()
|
|
|
|
| 35 |
payload = {"inputs": f"{prompt} {trigger_word}"}
|
| 36 |
|
| 37 |
headers = {"Authorization": f"Bearer {token}"}
|
| 38 |
+
|
| 39 |
+
# Add a print statement to display the API request
|
| 40 |
+
print(f"API Request: {api_url}")
|
| 41 |
+
print(f"API Headers: {headers}")
|
| 42 |
+
print(f"API Payload: {payload}")
|
| 43 |
+
|
| 44 |
response = requests.post(api_url, headers=headers, json=payload)
|
| 45 |
if response.status_code == 200:
|
| 46 |
return Image.open(io.BytesIO(response.content))
|
|
|
|
| 49 |
raise gr.Error("API Error: Unable to fetch the image.") # Raise a Gradio error here
|
| 50 |
|
| 51 |
|
| 52 |
+
|
| 53 |
with gr.Blocks(css="custom.css") as app:
|
| 54 |
title = gr.HTML("<h1>LoRA the Explorer</h1>")
|
| 55 |
selected_state = gr.State()
|