Spaces:
Runtime error
Runtime error
Commit
·
43500eb
1
Parent(s):
04c9189
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,7 +21,6 @@ with gr.Blocks() as demo: # Removed the css argument
|
|
| 21 |
"""<h1><img src="https://i.imgur.com/vT48NAO.png" alt="LoRA"> LoRA the Explorer</h1>""",
|
| 22 |
elem_id="title",
|
| 23 |
)
|
| 24 |
-
selected_state = gr.State()
|
| 25 |
gallery = gr.Gallery(
|
| 26 |
value=[(item["image"], item["title"]) for item in loras],
|
| 27 |
label="LoRA Gallery",
|
|
@@ -36,8 +35,8 @@ with gr.Blocks() as demo: # Removed the css argument
|
|
| 36 |
result = gr.Image(interactive=False, label="Generated Image", elem_id="result-image")
|
| 37 |
|
| 38 |
# Define the function to run when the button is clicked
|
| 39 |
-
def run_lora(prompt, weight
|
| 40 |
-
selected_lora = loras[
|
| 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
|
|
@@ -51,6 +50,6 @@ with gr.Blocks() as demo: # Removed the css argument
|
|
| 51 |
print("Starting Gradio UI...")
|
| 52 |
gr.Interface(
|
| 53 |
fn=run_lora,
|
| 54 |
-
inputs=[prompt, weight
|
| 55 |
outputs=[result],
|
| 56 |
).launch()
|
|
|
|
| 21 |
"""<h1><img src="https://i.imgur.com/vT48NAO.png" alt="LoRA"> LoRA the Explorer</h1>""",
|
| 22 |
elem_id="title",
|
| 23 |
)
|
|
|
|
| 24 |
gallery = gr.Gallery(
|
| 25 |
value=[(item["image"], item["title"]) for item in loras],
|
| 26 |
label="LoRA Gallery",
|
|
|
|
| 35 |
result = gr.Image(interactive=False, label="Generated Image", elem_id="result-image")
|
| 36 |
|
| 37 |
# Define the function to run when the button is clicked
|
| 38 |
+
def run_lora(prompt, weight):
|
| 39 |
+
selected_lora = loras[0] # You may need to adjust this index if you have multiple models
|
| 40 |
api_url = f"https://api-inference.huggingface.co/models/{selected_lora['repo']}"
|
| 41 |
trigger_word = selected_lora["trigger_word"]
|
| 42 |
token = os.getenv("API_TOKEN") # This will read the API token set in your managed environment
|
|
|
|
| 50 |
print("Starting Gradio UI...")
|
| 51 |
gr.Interface(
|
| 52 |
fn=run_lora,
|
| 53 |
+
inputs=[prompt, weight],
|
| 54 |
outputs=[result],
|
| 55 |
).launch()
|