Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- README.md +7 -6
- app.py +36 -0
- requirements.txt +5 -0
README.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title: Instruct
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Instruct IR
|
| 3 |
+
emoji: 🛠️
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: red
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 4.36.1
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
+
license: apache-2.0
|
| 11 |
---
|
| 12 |
|
| 13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import spaces
|
| 3 |
+
from panna import InstructIR
|
| 4 |
+
|
| 5 |
+
model = InstructIR()
|
| 6 |
+
title = "# Instruct IR"
|
| 7 |
+
css = """
|
| 8 |
+
#col-container {
|
| 9 |
+
margin: 0 auto;
|
| 10 |
+
max-width: 580px;
|
| 11 |
+
}
|
| 12 |
+
"""
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
@spaces.GPU
|
| 16 |
+
def infer(prompt, image):
|
| 17 |
+
return model(image=image, prompt=prompt,)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
with gr.Blocks(css=css) as demo:
|
| 21 |
+
with gr.Column(elem_id="col-container"):
|
| 22 |
+
gr.Markdown(title)
|
| 23 |
+
with gr.Row():
|
| 24 |
+
prompt = gr.Text(label="Prompt", show_label=False, max_lines=1, placeholder="Enter your prompt", container=False, value="Correct the blur in this image so it is more clear.")
|
| 25 |
+
negative_prompt = gr.Text(label="Negative Prompt", value="low quality, blurr", max_lines=1, placeholder="Enter a negative prompt")
|
| 26 |
+
run_button = gr.Button("Run", scale=0)
|
| 27 |
+
with gr.Row():
|
| 28 |
+
init_image = gr.Image(label="Input Image", type='pil')
|
| 29 |
+
result = gr.Image(label="Result", show_label=False)
|
| 30 |
+
gr.on(
|
| 31 |
+
triggers=[run_button.click, prompt.submit, negative_prompt.submit],
|
| 32 |
+
fn=infer,
|
| 33 |
+
inputs=[prompt, init_image],
|
| 34 |
+
outputs=[result]
|
| 35 |
+
)
|
| 36 |
+
demo.launch(server_name="0.0.0.0")
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
git+https://github.com/rwightman/pytorch-image-models.git
|
| 2 |
+
git+https://github.com/huggingface/diffusers.git
|
| 3 |
+
accelerate
|
| 4 |
+
sentencepiece
|
| 5 |
+
panna>=1.0.1
|