Spaces:
Runtime error
Runtime error
Dylan
commited on
Commit
Β·
d7d7a75
1
Parent(s):
6f322bd
test static inputs
Browse files
agents.py
CHANGED
|
@@ -55,7 +55,7 @@ model = Gemma3ForConditionalGeneration.from_pretrained(
|
|
| 55 |
# quantization_config=get_quantization_config(),
|
| 56 |
device_map="auto",
|
| 57 |
torch_dtype=torch.float16,
|
| 58 |
-
)
|
| 59 |
|
| 60 |
|
| 61 |
def describe_with_voice_dummy(state: State) -> State:
|
|
@@ -76,6 +76,8 @@ def describe_with_voice(state: State) -> State:
|
|
| 76 |
caption = state["caption"]
|
| 77 |
voice = state["voice"]
|
| 78 |
|
|
|
|
|
|
|
| 79 |
# Voice prompt templates
|
| 80 |
voice_prompts = {
|
| 81 |
"scurvy-ridden pirate": "You are a scurvy-ridden pirate, angry and drunk.",
|
|
@@ -118,6 +120,7 @@ def describe_with_voice(state: State) -> State:
|
|
| 118 |
def caption_image(state: State) -> State:
|
| 119 |
# image is PIL
|
| 120 |
image = state["image"]
|
|
|
|
| 121 |
|
| 122 |
# Load models (in practice, do this once and cache)
|
| 123 |
messages = [
|
|
|
|
| 55 |
# quantization_config=get_quantization_config(),
|
| 56 |
device_map="auto",
|
| 57 |
torch_dtype=torch.float16,
|
| 58 |
+
).eval()
|
| 59 |
|
| 60 |
|
| 61 |
def describe_with_voice_dummy(state: State) -> State:
|
|
|
|
| 76 |
caption = state["caption"]
|
| 77 |
voice = state["voice"]
|
| 78 |
|
| 79 |
+
caption = "A golden retriever that seems to be smiling straight to the camera"
|
| 80 |
+
|
| 81 |
# Voice prompt templates
|
| 82 |
voice_prompts = {
|
| 83 |
"scurvy-ridden pirate": "You are a scurvy-ridden pirate, angry and drunk.",
|
|
|
|
| 120 |
def caption_image(state: State) -> State:
|
| 121 |
# image is PIL
|
| 122 |
image = state["image"]
|
| 123 |
+
image = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg"
|
| 124 |
|
| 125 |
# Load models (in practice, do this once and cache)
|
| 126 |
messages = [
|