Spaces:
Running
on
Zero
Running
on
Zero
Update
Browse files- README.md +2 -1
- app.py +25 -18
- requirements.txt +4 -4
README.md
CHANGED
|
@@ -4,9 +4,10 @@ emoji: 🏢
|
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 3.
|
| 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
|
|
|
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 3.35.2
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
+
suggested_hardware: t4-small
|
| 11 |
---
|
| 12 |
|
| 13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
|
@@ -2,14 +2,14 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
|
|
|
|
|
|
| 5 |
import gradio as gr
|
|
|
|
| 6 |
|
| 7 |
from model import Model
|
| 8 |
|
| 9 |
-
DESCRIPTION = '
|
| 10 |
-
|
| 11 |
-
An unofficial demo for [https://github.com/giannisdaras/multires_textual_inversion](https://github.com/giannisdaras/multires_textual_inversion).
|
| 12 |
-
'''
|
| 13 |
|
| 14 |
DETAILS = '''
|
| 15 |
- To run the Semi Resolution-Dependent sampler, use the format: `<jane(number)>`.
|
|
@@ -20,8 +20,8 @@ For this demo, only `<jane>`, `<gta5-artwork>` and `<cat-toy>` are available.
|
|
| 20 |
Also, `number` should be an integer in [0, 9].
|
| 21 |
'''
|
| 22 |
|
| 23 |
-
|
| 24 |
-
CACHE_EXAMPLES
|
| 25 |
|
| 26 |
model = Model()
|
| 27 |
|
|
@@ -33,24 +33,30 @@ with gr.Blocks(css='style.css') as demo:
|
|
| 33 |
with gr.Row():
|
| 34 |
prompt = gr.Textbox(label='Prompt')
|
| 35 |
with gr.Row():
|
| 36 |
-
num_images = gr.Slider(
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
| 41 |
with gr.Row():
|
| 42 |
-
num_steps = gr.Slider(
|
| 43 |
-
|
| 44 |
-
|
| 45 |
step=1,
|
| 46 |
-
|
| 47 |
with gr.Row():
|
| 48 |
-
seed = gr.Slider(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
with gr.Row():
|
| 50 |
run_button = gr.Button('Run')
|
| 51 |
|
| 52 |
with gr.Column():
|
| 53 |
-
result = gr.Gallery(label='Result')
|
| 54 |
|
| 55 |
with gr.Row():
|
| 56 |
with gr.Group():
|
|
@@ -116,9 +122,10 @@ with gr.Blocks(css='style.css') as demo:
|
|
| 116 |
fn=model.run,
|
| 117 |
inputs=inputs,
|
| 118 |
outputs=result,
|
|
|
|
| 119 |
)
|
| 120 |
|
| 121 |
with gr.Accordion('About available prompts', open=False):
|
| 122 |
gr.Markdown(DETAILS)
|
| 123 |
|
| 124 |
-
demo.queue().launch(
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
import os
|
| 6 |
+
|
| 7 |
import gradio as gr
|
| 8 |
+
import torch
|
| 9 |
|
| 10 |
from model import Model
|
| 11 |
|
| 12 |
+
DESCRIPTION = '# [Multiresolution Textual Inversion](https://github.com/giannisdaras/multires_textual_inversion)'
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
DETAILS = '''
|
| 15 |
- To run the Semi Resolution-Dependent sampler, use the format: `<jane(number)>`.
|
|
|
|
| 20 |
Also, `number` should be an integer in [0, 9].
|
| 21 |
'''
|
| 22 |
|
| 23 |
+
CACHE_EXAMPLES = torch.cuda.is_available() and os.getenv(
|
| 24 |
+
'CACHE_EXAMPLES') == '1'
|
| 25 |
|
| 26 |
model = Model()
|
| 27 |
|
|
|
|
| 33 |
with gr.Row():
|
| 34 |
prompt = gr.Textbox(label='Prompt')
|
| 35 |
with gr.Row():
|
| 36 |
+
num_images = gr.Slider(
|
| 37 |
+
label='Number of images',
|
| 38 |
+
minimum=1,
|
| 39 |
+
maximum=9,
|
| 40 |
+
step=1,
|
| 41 |
+
value=1,
|
| 42 |
+
)
|
| 43 |
with gr.Row():
|
| 44 |
+
num_steps = gr.Slider(label='Number of inference steps',
|
| 45 |
+
minimum=1,
|
| 46 |
+
maximum=50,
|
| 47 |
step=1,
|
| 48 |
+
value=10)
|
| 49 |
with gr.Row():
|
| 50 |
+
seed = gr.Slider(label='Seed',
|
| 51 |
+
minimum=0,
|
| 52 |
+
maximum=100000,
|
| 53 |
+
step=1,
|
| 54 |
+
value=100)
|
| 55 |
with gr.Row():
|
| 56 |
run_button = gr.Button('Run')
|
| 57 |
|
| 58 |
with gr.Column():
|
| 59 |
+
result = gr.Gallery(label='Result', object_fit='scale-down')
|
| 60 |
|
| 61 |
with gr.Row():
|
| 62 |
with gr.Group():
|
|
|
|
| 122 |
fn=model.run,
|
| 123 |
inputs=inputs,
|
| 124 |
outputs=result,
|
| 125 |
+
api_name='run',
|
| 126 |
)
|
| 127 |
|
| 128 |
with gr.Accordion('About available prompts', open=False):
|
| 129 |
gr.Markdown(DETAILS)
|
| 130 |
|
| 131 |
+
demo.queue(max_size=10).launch()
|
requirements.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
accelerate==0.
|
| 2 |
diffusers==0.9.0
|
| 3 |
ftfy==6.1.1
|
| 4 |
-
Pillow==
|
| 5 |
-
torch==1.
|
| 6 |
-
transformers==4.
|
|
|
|
| 1 |
+
accelerate==0.20.3
|
| 2 |
diffusers==0.9.0
|
| 3 |
ftfy==6.1.1
|
| 4 |
+
Pillow==10.0.0
|
| 5 |
+
torch==1.13.1
|
| 6 |
+
transformers==4.30.2
|