Spaces:
Running
on
Zero
Running
on
Zero
Dylan
commited on
Commit
·
73d2daa
1
Parent(s):
350f8a0
added spaces GPU
Browse files
agents.py
CHANGED
@@ -110,6 +110,7 @@ def describe_with_voice(state: State) -> State:
|
|
110 |
description = processor.decode(generation, skip_special_tokens=True)
|
111 |
|
112 |
state["description"] = description
|
|
|
113 |
|
114 |
return state
|
115 |
|
@@ -153,5 +154,6 @@ def caption_image(state: State) -> State:
|
|
153 |
caption = processor.decode(generation, skip_special_tokens=True)
|
154 |
|
155 |
state["caption"] = caption
|
|
|
156 |
|
157 |
return state
|
|
|
110 |
description = processor.decode(generation, skip_special_tokens=True)
|
111 |
|
112 |
state["description"] = description
|
113 |
+
print(description)
|
114 |
|
115 |
return state
|
116 |
|
|
|
154 |
caption = processor.decode(generation, skip_special_tokens=True)
|
155 |
|
156 |
state["caption"] = caption
|
157 |
+
print(caption)
|
158 |
|
159 |
return state
|
app.py
CHANGED
@@ -1,18 +1,19 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
from agents import build_graph
|
|
|
4 |
|
5 |
# Initialize the graph
|
6 |
graph = build_graph()
|
7 |
|
8 |
|
|
|
9 |
def process_and_display(image, voice):
|
10 |
# Initialize state
|
11 |
state = {"image": image, "voice": voice, "caption": "", "description": ""}
|
12 |
|
13 |
# Run the graph
|
14 |
result = graph.invoke(state)
|
15 |
-
print(result)
|
16 |
|
17 |
# Return the caption and description
|
18 |
return result["caption"], result["description"]
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
from agents import build_graph
|
4 |
+
import spaces
|
5 |
|
6 |
# Initialize the graph
|
7 |
graph = build_graph()
|
8 |
|
9 |
|
10 |
+
@spaces.GPU(duration=60)
|
11 |
def process_and_display(image, voice):
|
12 |
# Initialize state
|
13 |
state = {"image": image, "voice": voice, "caption": "", "description": ""}
|
14 |
|
15 |
# Run the graph
|
16 |
result = graph.invoke(state)
|
|
|
17 |
|
18 |
# Return the caption and description
|
19 |
return result["caption"], result["description"]
|