Spaces:
Running
on
Zero
Running
on
Zero
Staticaliza
commited on
Commit
•
e7322bf
1
Parent(s):
eb3d2f3
Update app.py
Browse files
app.py
CHANGED
@@ -28,10 +28,13 @@ footer {
|
|
28 |
|
29 |
# Functions
|
30 |
@spaces.GPU(duration=60)
|
31 |
-
def generate(image, instruction=DEFAULT_INPUT, sampling=False, temperature=0.7, top_p=0.8, top_k=100, repetition_penalty=1.05, max_tokens=512):
|
32 |
repo.to(DEVICE)
|
33 |
|
34 |
print(image)
|
|
|
|
|
|
|
35 |
image_data = Image.fromarray(image.astype('uint8'), 'RGB')
|
36 |
print(image_data, instruction)
|
37 |
|
@@ -60,6 +63,7 @@ with gr.Blocks(css=css) as main:
|
|
60 |
|
61 |
with gr.Column():
|
62 |
input = gr.Image(label="Image")
|
|
|
63 |
instruction = gr.Textbox(lines=1, value=DEFAULT_INPUT, label="Instruction")
|
64 |
sampling = gr.Checkbox(value=False, label="Sampling")
|
65 |
temperature = gr.Slider(minimum=0.01, maximum=1.99, step=0.01, value=0.7, label="Temperature")
|
@@ -73,7 +77,7 @@ with gr.Blocks(css=css) as main:
|
|
73 |
with gr.Column():
|
74 |
output = gr.Textbox(lines=1, value="", label="Output")
|
75 |
|
76 |
-
submit.click(fn=generate, inputs=[input, instruction, sampling, temperature, top_p, top_k, repetition_penalty, max_tokens], outputs=[output], queue=False)
|
77 |
maintain.click(cloud, inputs=[], outputs=[], queue=False)
|
78 |
|
79 |
main.launch(show_api=True)
|
|
|
28 |
|
29 |
# Functions
|
30 |
@spaces.GPU(duration=60)
|
31 |
+
def generate(image, video, instruction=DEFAULT_INPUT, sampling=False, temperature=0.7, top_p=0.8, top_k=100, repetition_penalty=1.05, max_tokens=512):
|
32 |
repo.to(DEVICE)
|
33 |
|
34 |
print(image)
|
35 |
+
print(video)
|
36 |
+
print(not video)
|
37 |
+
|
38 |
image_data = Image.fromarray(image.astype('uint8'), 'RGB')
|
39 |
print(image_data, instruction)
|
40 |
|
|
|
63 |
|
64 |
with gr.Column():
|
65 |
input = gr.Image(label="Image")
|
66 |
+
input_2 = gr.Image(label="Video")
|
67 |
instruction = gr.Textbox(lines=1, value=DEFAULT_INPUT, label="Instruction")
|
68 |
sampling = gr.Checkbox(value=False, label="Sampling")
|
69 |
temperature = gr.Slider(minimum=0.01, maximum=1.99, step=0.01, value=0.7, label="Temperature")
|
|
|
77 |
with gr.Column():
|
78 |
output = gr.Textbox(lines=1, value="", label="Output")
|
79 |
|
80 |
+
submit.click(fn=generate, inputs=[input, input_2, instruction, sampling, temperature, top_p, top_k, repetition_penalty, max_tokens], outputs=[output], queue=False)
|
81 |
maintain.click(cloud, inputs=[], outputs=[], queue=False)
|
82 |
|
83 |
main.launch(show_api=True)
|