Skip to content

Instantly share code, notes, and snippets.

View fancellu's full-sized avatar

Dino Fancellu fancellu

View GitHub Profile
@fancellu
fancellu / kontext_gpu_4bit.py
Last active July 18, 2025 11:51
Gradio demo for FluxContextDev but 4bit quant, fits on a 4090
import gradio as gr
import numpy as np
import spaces
import torch
import random
from PIL import Image
from diffusers import FluxKontextPipeline
from diffusers.utils import load_image
@fancellu
fancellu / app.py
Last active July 14, 2025 17:52
Huggingface Spaces Bitcoin Volume Plotly, interactive
import pandas as pd
import plotly.graph_objects as go
import gradio as gr
from io import StringIO
def create_interactive_bitcoin_chart(csv_text=None):
"""Create interactive Bitcoin volume chart from CSV data"""
try:
if csv_text and csv_text.strip():
@fancellu
fancellu / README.md
Last active July 4, 2025 20:12
Kokoro-TTS-Zero-CPU
@fancellu
fancellu / README.md
Last active July 4, 2025 14:56
bark-pytorch2.6-compatible

https://huggingface.co/spaces/Fancellu/bark-pytorch2.6-compatible

This solves the PyTorch 2.6 breaking change where weights_only=True became the default, causing issues with older model files that contain non-tensor objects, with monkey patch patched_load()

Updated to Python 3.11, latest Gradio, and requirements.txt

If you have a GPU, you can run from Docker Desktop directly

docker run -it -p 7860:7860 --gpus=all --platform=linux/amd64 registry.hf.space/fancellu-bark-pytorch2-6-compatible:latest python app.py

@fancellu
fancellu / CatsAlign.scala
Created May 26, 2020 07:44
Example usage of Cats Align
import cats._
import cats.data._
import cats.syntax._
import cats.implicits._
object CatsAlign extends App {
val alOption=Align[Option]
val iorO: Option[Ior[Int, Int]] =alOption.align(Option(1), Option(2))
@fancellu
fancellu / .block
Last active February 8, 2025 21:03
Force directed graph for D3.js v4 with labelled edges and arrows
license: gpl-3.0
height: 600
@fancellu
fancellu / ConsumerExample.scala
Last active November 28, 2024 13:00
Kafka Producer/Consumer Example in Scala
import java.util
import org.apache.kafka.clients.consumer.KafkaConsumer
import scala.collection.JavaConverters._
object ConsumerExample extends App {
import java.util.Properties
@fancellu
fancellu / MyIO.scala
Last active October 5, 2024 13:24
Simple example of an IO effect Monad, no Cats, no ZIO
import scala.util.Random
// Simple example of an IO effect Monad, no Cats
object MyIO extends App{
// IO encapsulates a side effecting operation
final class IO[A](val run: () => A) {
def map[B](f: A => B): IO[B] = IO(f(run()))
@fancellu
fancellu / dining.go
Last active September 30, 2024 21:49
Dining philosophers in golang (I have other impls in Rust, Scala, Scala+Cats effect here)
package main
import (
"fmt"
"math/rand"
"sync"
"time"
"unsafe"
)
@fancellu
fancellu / main.go
Created August 24, 2024 10:55
Golang goroutine channel sync and timeout example
package main
import (
"fmt"
"time"
)
func greet(st string, done chan bool) {
fmt.Println(st)
done <- true