Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update - Nibbler Placeholder #303

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ const SelectBetweenImagesGenerative: FC<
const [showImages, setShowImages] = useState<any[]>([]);
const [isMobile, setIsMobile] = useState(false);
const [artifactsInput, setArtifactsInput] = useState<any>(
generative_context.artifacts,
generative_context.artifacts
);
const [prompt, setPrompt] = useState(
"Type your prompt here (e.g. a kid sleeping in a red pool of paint)",
"People from {region} doing a {local activity}. Eg. 'Old Bhopalis sitting near 10 number market'."
);
const { post, response } = useFetch();
const { user } = useContext(UserContext);
const { modelInputs, metadataExample, updateModelInputs } = useContext(
CreateInterfaceContext,
CreateInterfaceContext
);
const neccessaryFields = ["original_prompt"];
const [selectedImage, setSelectedImage] = useState<string>("");
Expand All @@ -54,7 +54,7 @@ const SelectBetweenImagesGenerative: FC<
{
task_id: taskId,
user_id: user.id,
},
}
);
if (response.ok) {
setPromptHistory(history);
Expand Down Expand Up @@ -83,7 +83,7 @@ const SelectBetweenImagesGenerative: FC<

const saveHistoricalData = async (
text: string,
setPromptHistory: (value: any[]) => void,
setPromptHistory: (value: any[]) => void
) => {
const history = await post("/historical_data/save_historical_data", {
task_id: taskId,
Expand All @@ -110,7 +110,7 @@ const SelectBetweenImagesGenerative: FC<
task_id: taskId,
user_id: user.id,
data: prompt.trim(),
},
}
);
if (checkIfPromptExistsForUser) {
setFirstMessageReceived(true);
Expand All @@ -125,15 +125,15 @@ const SelectBetweenImagesGenerative: FC<
body: JSON.stringify({
task_id: taskId,
}),
},
}
);

const promptWithMoreThanOneHundredSubmissions =
await responseHistory.json();

const checkIfPromptIsInOccurrences =
promptWithMoreThanOneHundredSubmissions.some(
(item: any) => item === prompt.trim(),
(item: any) => item === prompt.trim()
);
if (checkIfPromptIsInOccurrences) {
Swal.fire({
Expand All @@ -151,7 +151,7 @@ const SelectBetweenImagesGenerative: FC<
neccessaryFields.every(
(item) =>
modelInputs.hasOwnProperty(item) ||
metadataExample.hasOwnProperty(item),
metadataExample.hasOwnProperty(item)
)
) {
setShowLoader(true);
Expand All @@ -174,7 +174,7 @@ const SelectBetweenImagesGenerative: FC<
prompt_with_more_than_one_hundred: checkIfPromptIsInOccurrences,
},
}),
},
}
);

const imagesHttp = await response.json();
Expand Down Expand Up @@ -212,7 +212,7 @@ const SelectBetweenImagesGenerative: FC<
{
round_id: realRoundId,
user_id: user.id,
},
}
);
} else {
Swal.fire({
Expand Down Expand Up @@ -270,7 +270,7 @@ const SelectBetweenImagesGenerative: FC<
prompt_with_more_than_one_hundred: checkIfPromptIsInOccurrences,
},
}),
},
}
);

const imagesHttp = await response.json();
Expand Down Expand Up @@ -325,7 +325,7 @@ const SelectBetweenImagesGenerative: FC<
user_id: user.id,
round_id: realRoundId,
task_id: taskId,
},
}
);
if (response.ok) {
setPartialSampleId(partialSampleId.id);
Expand Down
Loading