mirror of
https://github.com/gradio-app/gradio.git
synced 2025-03-31 12:20:26 +08:00
fixes with HighlightedText, variables (#1563)
* changes * removed comment things * updated version Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
This commit is contained in:
parent
cb2aa4a625
commit
6413b65328
@ -199,6 +199,10 @@ def update(**kwargs) -> dict:
|
||||
return kwargs
|
||||
|
||||
|
||||
def is_update(val):
|
||||
return type(val) is dict and "update" in val.get("__type__", "")
|
||||
|
||||
|
||||
def skip() -> dict:
|
||||
return update()
|
||||
|
||||
@ -488,13 +492,12 @@ class Blocks(BlockContext):
|
||||
for i, output_id in enumerate(dependency["outputs"]):
|
||||
block = self.blocks[output_id]
|
||||
if getattr(block, "stateful", False):
|
||||
state[output_id] = predictions[i]
|
||||
if not is_update(predictions[i]):
|
||||
state[output_id] = predictions[i]
|
||||
output.append(None)
|
||||
else:
|
||||
prediction_value = predictions[i]
|
||||
if type(
|
||||
prediction_value
|
||||
) is dict and "update" in prediction_value.get("__type__", ""):
|
||||
if is_update(prediction_value):
|
||||
if prediction_value["__type__"] == "generic_update":
|
||||
del prediction_value["__type__"]
|
||||
prediction_value = block.__class__.update(
|
||||
|
@ -1 +1 @@
|
||||
3.0.16
|
||||
3.0.18
|
||||
|
@ -26,11 +26,10 @@
|
||||
|
||||
let mode: "categories" | "scores";
|
||||
|
||||
if (color_map === null) {
|
||||
color_map = {};
|
||||
}
|
||||
|
||||
$: {
|
||||
if (!color_map) {
|
||||
color_map = {};
|
||||
}
|
||||
if (value.length > 0) {
|
||||
for (let [_, label] of value) {
|
||||
if (label !== null) {
|
||||
@ -118,7 +117,7 @@
|
||||
>
|
||||
<span class="text ">{text}</span>
|
||||
{#if !show_legend && category !== null}
|
||||
<span
|
||||
<span
|
||||
class="label mr-[-4px] font-bold uppercase text-xs inline-category text-white rounded-sm px-[0.325rem] mt-[0.05rem] py-[0.05rem] transition-colors"
|
||||
style:background-color={category === null ||
|
||||
(active && active !== category)
|
||||
@ -127,8 +126,8 @@
|
||||
>
|
||||
{category}
|
||||
</span>
|
||||
{/if}
|
||||
</span>
|
||||
{/if}</span
|
||||
>
|
||||
{/each}
|
||||
</div>
|
||||
{:else}
|
||||
|
Loading…
x
Reference in New Issue
Block a user